diff --git a/CMakeLists.txt b/CMakeLists.txt index 32fe0bf6de9d4f90d115500ffec99a76619407bb..51433c57414e9a5d19c569d4dcc38a647d9bc830 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ # Defines EOS library target. project( EOS ) + cmake_minimum_required( VERSION 2.8.12 ) enable_testing() @@ -7,8 +8,10 @@ enable_testing() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") -INCLUDE( VersionMacros ) -INCLUDE( SetupTargetMacros ) +include( GNUInstallDirs ) +include( VersionMacros ) +include( SetupTargetMacros ) +include( InstallDirectoryPermissions ) set( BLOCKCHAIN_NAME "Eos" ) set( CMAKE_CXX_STANDARD 14 ) @@ -17,8 +20,8 @@ set(VERSION_MAJOR 3) set(VERSION_MINOR 0) set(VERSION_PATCH 1) -set( CLI_CLIENT_EXECUTABLE_NAME eos_client ) -set( GUI_CLIENT_EXECUTABLE_NAME eos ) +set( CLI_CLIENT_EXECUTABLE_NAME eosioc ) +set( GUI_CLIENT_EXECUTABLE_NAME eosio ) set( CUSTOM_URL_SCHEME "gcs" ) set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" ) @@ -45,6 +48,34 @@ if (USE_PCH) include (cotire) endif(USE_PCH) +# add defaults for openssl +if ("${OPENSSL_ROOT_DIR}" STREQUAL "") + if (NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "") + set(OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR}) + set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include) + elseif (APPLE) + set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") + set(OPENSSL_INCLUDE_DIR "/usr/local/opt/openssl/include") + elseif(UNIX AND NOT APPLE) + set(OPENSSL_ROOT_DIR "/usr/include/openssl") + set(OPENSSL_INCLUDE_DIR "/usr/include/openssl/include") + else() + message(FATAL_ERROR "openssl not found and don't know where to look, please specify OPENSSL_ROOT_DIR") + endif() +endif() + +if ("${OPENSSL_LIBRARIES}" STREQUAL "") + if (NOT "$ENV{OPENSSL_LIBRARIES}" STREQUAL "") + set(OPENSSL_LIBRARIES $ENV{OPENSSL_LIBRARIES}) + elseif (APPLE) + set(OPENSSL_LIBRARIES "/usr/local/opt/openssl/lib") + elseif(UNIX AND NOT APPLE) + set(OPENSSL_LIBRARIES "/usr/include/openssl") + else() + message(FATAL_ERROR "openssl libs not found and don't know where to look, please specify OPENSSL_LIBRARIES") + endif() +endif() + if(UNIX) if(APPLE) set(whole_archive_flag "-force_load") @@ -113,12 +144,6 @@ if( WIN32 ) else( WIN32 ) # Apple AND Linux - find_library(READLINE_LIBRARIES NAMES readline) - find_path(READLINE_INCLUDE_DIR readline/readline.h) - #if(NOT READLINE_INCLUDE_DIR OR NOT READLINE_LIBRARIES) - # MESSAGE(FATAL_ERROR "Could not find lib readline.") - #endif() - if( APPLE ) # Apple Specific Options Here message( STATUS "Configuring Eos on OS X" ) @@ -163,20 +188,25 @@ if(ENABLE_COVERAGE_TESTING) find_program( GENHTML_PATH NAMES genhtml) endif() +add_subdirectory( externals ) + include(wasm) -include(installer) include(softfloat) -add_subdirectory( externals ) -add_subdirectory( contracts ) add_subdirectory( libraries ) +add_subdirectory( contracts ) add_subdirectory( plugins ) add_subdirectory( programs ) add_subdirectory( scripts ) add_subdirectory( tests ) add_subdirectory( tools ) +add_subdirectory( debian ) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/genesis.json ${CMAKE_CURRENT_BINARY_DIR}/genesis.json COPYONLY) +install(FILES genesis.json DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio/node_00) +install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio) +install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio/node_00) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/genesis.json ${CMAKE_CURRENT_BINARY_DIR}/etc/eosio/node_00/genesis.json COPYONLY) +include(installer) include(doxygen) diff --git a/CMakeModules/FindSoftfloat.cmake b/CMakeModules/FindSoftfloat.cmake index 79e2e3c49bdfdfb53274eb6816b7907a95419954..13cd4d37cfd160b3b50d31bc65a7184e62ba16ed 100644 --- a/CMakeModules/FindSoftfloat.cmake +++ b/CMakeModules/FindSoftfloat.cmake @@ -1,5 +1,16 @@ # - Try to find SOFTFLOAT # TODO: Check if compiler is able to generate wasm32 +if ("${SOFTFLOAT_ROOT}" STREQUAL "") + if (NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "") + set(SOFTFLOAT_ROOT $ENV{SOFTFLOAT_ROOT}) + elseif (APPLE) + set(SOFTFLOAT_ROOT "/usr/local/berkeley-softfloat-3") + elseif(UNIX AND NOT APPLE) + set(SOFTFLOAT_ROOT "/opt/berkeley-softfloat-3") + else() + message(FATAL_ERROR "softfloat not found and don't know where to look, please specify SOFTFLOAT_ROOT") + endif() +endif() message( STATUS "Looking for softfloat library" ) find_library( SOFTFLOAT_LIB libsoftfloat.a PATHS ${SOFTFLOAT_ROOT} NO_DEFAULT_PATH ) diff --git a/CMakeModules/FindWasm.cmake b/CMakeModules/FindWasm.cmake index d4e4b6fe066751d0baa4e9e3530adba193d02f59..3f46bcaeb7589064d6a69404521612236bfd2c63 100644 --- a/CMakeModules/FindWasm.cmake +++ b/CMakeModules/FindWasm.cmake @@ -1,6 +1,17 @@ # - Try to find WASM # TODO: Check if compiler is able to generate wasm32 +if ("${WASM_ROOT}" STREQUAL "") + # if (NOT "$ENV{WASM_ROOT}" STREQUAL "") + # set( WASM_ROOT $ENV{WASM_ROOT} ) + if (APPLE) + set( WASM_ROOT "/usr/local/wasm" ) + elseif (UNIX AND NOT APPLE) + set( WASM_ROOT "/opt/wasm" ) + else() + message(FATAL_ERROR "WASM not found and don't know where to look, please specify WASM_ROOT") + endif() +endif() find_program(WASM_CLANG clang PATHS ${WASM_ROOT}/bin NO_DEFAULT_PATH) find_program(WASM_LLC llc PATHS ${WASM_ROOT}/bin NO_DEFAULT_PATH) find_program(WASM_LLVM_LINK llvm-link PATHS ${WASM_ROOT}/bin NO_DEFAULT_PATH) diff --git a/CMakeModules/InstallDirectoryPermissions.cmake b/CMakeModules/InstallDirectoryPermissions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b13a806929a6ce0650630e580bbdb8bbbfafa654 --- /dev/null +++ b/CMakeModules/InstallDirectoryPermissions.cmake @@ -0,0 +1,14 @@ +# Fix directory permissions after installation of header files (primarily). +macro(install_directory_permissions) + cmake_parse_arguments(ARG "" "DIRECTORY" "" ${ARGN}) + set(dir ${ARG_DIRECTORY}) + install(DIRECTORY DESTINATION ${dir} + DIRECTORY_PERMISSIONS OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + GROUP_EXECUTE + WORLD_READ + WORLD_EXECUTE + ) +endmacro(install_directory_permissions) diff --git a/CMakeModules/installer.cmake b/CMakeModules/installer.cmake index b8755f3df63c5591d930499d54fd9eee1342414e..797fd2606f5dee595e81bb7a6499461038b40977 100644 --- a/CMakeModules/installer.cmake +++ b/CMakeModules/installer.cmake @@ -1,36 +1,49 @@ include(InstallRequiredSystemLibraries) +#install_directory_permissions( DIRECTORY usr/${CMAKE_INSTALL_INCLUDEDIR}/eosio ) + set(CPACK_PACKAGE_CONTACT "support@block.one") set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_BINARY_DIR}/packages) -set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install) +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install) +endif() -SET(CPACK_PACKAGE_DIRECTORY "${CMAKE_INSTALL_PREFIX}") +SET(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/install") set(CPACK_PACKAGE_NAME "EOS.IO") set(CPACK_PACKAGE_VENDOR "block.one") set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") -set(CPACK_PACKAGE_DESCRIPTION "A client for the EOS.IO network") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A client for the EOS.IO network") +set(CPACK_PACKAGE_DESCRIPTION "Software for the EOS.IO network") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Software for the EOS.IO network") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") set(CPACK_PACKAGE_INSTALL_DIRECTORY "EOS.IO ${CPACK_PACKAGE_VERSION}") if(WIN32) - set(CPACK_GENERATOR "ZIP;NSIS") - set(CPACK_NSIS_EXECUTABLES_DIRECTORY .) - set(CPACK_NSIS_PACKAGE_NAME "EOS.IO v${CPACK_PACKAGE_VERSION}") - set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}") - set(CPACK_NSIS_DEFINES " !define MUI_STARTMENUPAGE_DEFAULTFOLDER \\\"EOS.IO\\\"") - # it seems like windows zip files usually don't have a single directory inside them, unix tgz frequently do - SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) + set(CPACK_GENERATOR "ZIP;NSIS") + set(CPACK_NSIS_EXECUTABLES_DIRECTORY .) + set(CPACK_NSIS_PACKAGE_NAME "EOS.IO v${CPACK_PACKAGE_VERSION}") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}") + set(CPACK_NSIS_DEFINES " !define MUI_STARTMENUPAGE_DEFAULTFOLDER \\\"EOS.IO\\\"") + # windows zip files usually don't have a single directory inside them, unix tgz usually do + set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) elseif(APPLE) set(CPACK_GENERATOR "DragNDrop") else() - # Linux gets a .tgz - SET(CPACK_GENERATOR "TGZ;DEB") - SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) - SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1) + set(CPACK_GENERATOR "DEB") + set(CPACK_DEBIAN_PACKAGE_RELEASE 0) + if(CMAKE_VERSION VERSION_GREATER 3.6.0) # Buggy in 3.5, behaves like VERSION_GREATER_EQUAL + set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") + else() + string(TOLOWER ${CPACK_PACKAGE_NAME} CPACK_DEBIAN_PACKAGE_NAME) + execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) + SET(CPACK_PACKAGE_FILE_NAME ${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}) + endif() + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) + set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY TRUE) + set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) + set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/EOSIO/eos") endif() include(CPack) diff --git a/CMakeModules/wasm.cmake b/CMakeModules/wasm.cmake index d151a543ff744e622baa885c24b5c5021a14f912..85f4b091b9e2839c52c24d7c046df5274b7dda70 100644 --- a/CMakeModules/wasm.cmake +++ b/CMakeModules/wasm.cmake @@ -190,4 +190,7 @@ macro(add_wast_executable) set(extra_target_dependency) + add_test(NAME "validate_${target}_abi" + COMMAND ${CMAKE_BINARY_DIR}/scripts/abi_is_json.py ${ABI_FILES}) + endmacro(add_wast_executable) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index f4dd8de792d1846b276ae900d8e6257243d26339..2da2f2662de226613ff76ddc899686ee08bcf9ad 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -32,26 +32,26 @@ RUN wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar. && echo 'using clang : 4.0 : clang++-4.0 ;' >> project-config.jam \ && ./b2 -d0 -j$(nproc) --with-thread --with-date_time --with-system --with-filesystem --with-program_options \ --with-signals --with-serialization --with-chrono --with-test --with-context --with-locale --with-coroutine --with-iostreams toolset=clang link=static install \ - && cd .. && rm -rf boost_1_64_0 + && cd - && rm -rf boost_1_64_0 RUN wget https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz -O - | tar -xz \ && cd mongo-c-driver-1.9.3 \ && ./configure --disable-automatic-init-and-cleanup --prefix=/usr/local \ && make -j$(nproc) install \ - && cd .. && rm -rf mongo-c-driver-1.9.3 + && cd - && rm -rf mongo-c-driver-1.9.3 RUN git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git \ && git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git llvm/tools/clang \ && cd llvm \ && cmake -H. -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=/opt/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release \ && cmake --build build --target install \ - && cd .. && rm -rf llvm + && cd - && rm -rf llvm RUN wget https://github.com/WebAssembly/binaryen/archive/1.37.21.tar.gz -O - | tar -xz \ && cd binaryen-1.37.21 \ && cmake -H. -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release \ && cmake --build build --target install \ - && cd .. && rm -rf binaryen-1.37.21 + && cd - && rm -rf binaryen-1.37.21 RUN git clone --depth 1 git://github.com/cryptonomex/secp256k1-zkp \ @@ -59,12 +59,19 @@ RUN git clone --depth 1 git://github.com/cryptonomex/secp256k1-zkp \ && ./autogen.sh \ && ./configure --prefix=/usr/local \ && make -j$(nproc) install \ - && cd .. && rm -rf secp256k1-zkp + && cd - && rm -rf secp256k1-zkp RUN git clone --depth 1 -b releases/stable git://github.com/mongodb/mongo-cxx-driver \ && cd mongo-cxx-driver \ && cmake -H. -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local\ - && cmake --build build --target install + && cmake --build build --target install && cd - && rm -rf mongo-cxx-driver + +RUN git clone --depth 1 --single-branch --branch master https://github.com/ucb-bar/berkeley-softfloat-3.git \ + && cd berkeley-softfloat-3/build/Linux-x86_64-GCC \ + && make -j${nproc} SPECIALIZE_TYPE="8086-SSE" SOFTFLOAT_OPS="-DSOFTFLOAT_ROUND_EVEN -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32" \ + && mkdir -p /opt/berkeley-softfloat-3 && cp softfloat.a /opt/berkeley-softfloat-3/libsoftfloat.a \ + && mv ../../source/include /opt/berkeley-softfloat-3/include && cd - && rm -rf berkeley-softfloat-3 +ENV SOFTFLOAT_ROOT /opt/berkeley-softfloat-3 ### If you don't want to change the depedencies, you can comment out above lines and uncomnent the following line to get faster build time. # FROM huangminghuang/eos_builder as builder @@ -72,16 +79,17 @@ RUN git clone --depth 1 -b releases/stable git://github.com/mongodb/mongo-cxx-dr RUN git clone -b master --depth 1 https://github.com/EOSIO/eos.git --recursive \ && cd eos \ && cmake -H. -B"/tmp/build" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eos -DSecp256k1_ROOT_DIR=/usr/local \ + -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build -DSecp256k1_ROOT_DIR=/usr/local \ && cmake --build /tmp/build --target install FROM ubuntu:16.04 RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl && rm -rf /var/lib/apt/lists/* COPY --from=builder /usr/local/lib/* /usr/local/lib/ -COPY --from=builder /tmp/build/install/bin /opt/eosio/bin +COPY --from=builder /tmp/build/bin /opt/eosio/bin COPY --from=builder /tmp/build/contracts /contracts COPY --from=builder /eos/Docker/config.ini /eos/genesis.json / COPY start_eosiod.sh /opt/eosio/bin/start_eosiod.sh +ENV EOSIO_ROOT=/opt/eosio RUN chmod +x /opt/eosio/bin/start_eosiod.sh ENV LD_LIBRARY_PATH /usr/local/lib VOLUME /opt/eosio/bin/data-dir diff --git a/Jenkinsfile b/Jenkinsfile index 4839c726c9511ee4fb3e9ab698c9ad1617a377fd..d6c4f5aa96940d50aa23bf7842ce7cbd68f6f674 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,6 +46,14 @@ pipeline { ctest --output-on-failure ''' } + post { + failure { + archiveArtifacts 'build/genesis.json' + archiveArtifacts 'build/tn_data_00/config.ini' + archiveArtifacts 'build/tn_data_00/stderr.txt' + archiveArtifacts 'build/test_walletd_output.log' + } + } } stage('MacOS') { agent { label 'MacOS' } @@ -59,6 +67,14 @@ pipeline { ctest --output-on-failure ''' } + post { + failure { + archiveArtifacts 'build/genesis.json' + archiveArtifacts 'build/tn_data_00/config.ini' + archiveArtifacts 'build/tn_data_00/stderr.txt' + archiveArtifacts 'build/test_walletd_output.log' + } + } } stage('Fedora') { agent { label 'Fedora' } @@ -72,6 +88,14 @@ pipeline { ctest --output-on-failure ''' } + post { + failure { + archiveArtifacts 'build/genesis.json' + archiveArtifacts 'build/tn_data_00/config.ini' + archiveArtifacts 'build/tn_data_00/stderr.txt' + archiveArtifacts 'build/test_walletd_output.log' + } + } } } } diff --git a/contracts/CMakeLists.txt b/contracts/CMakeLists.txt index 33f091db22bbfb6131e4feff6d0a548073aaf49e..c304db1508fd00cb8474f04bd6615528fd3499c3 100644 --- a/contracts/CMakeLists.txt +++ b/contracts/CMakeLists.txt @@ -29,7 +29,20 @@ add_subdirectory(simpledb) add_subdirectory(test.system) add_subdirectory(noop) -install( DIRECTORY eosiolib DESTINATION include/ ) -install( DIRECTORY musl DESTINATION include/ ) -install( DIRECTORY libc++ DESTINATION include/ ) -install( DIRECTORY skeleton DESTINATION share/ ) +file(GLOB SKELETONS RELATIVE ${CMAKE_SOURCE_DIR}/contracts "skeleton/*") + +# Documented multiple output support is broken, so properly setting up the multiple +# dependencies in the custom target is not possible. (CMake 3.5) +add_custom_command(OUTPUT share/eosio/skeleton/skeleton.cpp + COMMAND ${CMAKE_COMMAND} -E make_directory ../share/eosio/skeleton + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/skeleton ../share/eosio/skeleton + DEPENDS ${SKELETONS} + COMMENT Copying skeleton contract... + VERBATIM) +add_custom_target(copy_skeleton_contract ALL DEPENDS share/eosio/skeleton/skeleton.cpp) + +install(DIRECTORY eosiolib DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) +install(DIRECTORY musl DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) +install(DIRECTORY libc++ DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) +install(DIRECTORY skeleton DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/eosio) +install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_DATAROOTDIR}/eosio) diff --git a/contracts/asserter/asserter.cpp b/contracts/asserter/asserter.cpp index 059d50d86d7d1a04e8a6470da84aca94766cac05..9a0706c3eec551d044a49340215cd2a07eba4c8b 100644 --- a/contracts/asserter/asserter.cpp +++ b/contracts/asserter/asserter.cpp @@ -29,7 +29,7 @@ extern "C" { } // maybe assert? - eosio_assert(def->condition, def->message); + eosio_assert((uint32_t)def->condition, def->message); } else if( action == N(provereset) ) { eosio_assert(global_variable == 45, "Global Variable Initialized poorly"); global_variable = 100; diff --git a/contracts/eosio.system/eosio.system.abi b/contracts/eosio.system/eosio.system.abi index 41278cf63429b5d38fe7d97831ceeda929e5bc2a..9fa2ef2262e6993bcba990b88cace5f5febd2d24 100644 --- a/contracts/eosio.system/eosio.system.abi +++ b/contracts/eosio.system/eosio.system.abi @@ -33,14 +33,14 @@ "name": "regproducer", "base": "", "fields": [ - {"name":"producer", "type":"account_name"} + {"name":"producer", "type":"account_name"}, {"name":"producer_key", "type":"bytes"} ] },{ "name": "stakevote", "base": "", "fields": [ - {"name":"voter", "type":"account_name"} + {"name":"voter", "type":"account_name"}, {"name":"amount", "type":"asset"} ] } diff --git a/contracts/eosiolib/compiler_builtins.h b/contracts/eosiolib/compiler_builtins.h index 2b1cf78eb35e7c0495bf3eb84fd9f388c69c918e..cd69d1dee8e44c801f6fe4a49a41bd265437e89c 100644 --- a/contracts/eosiolib/compiler_builtins.h +++ b/contracts/eosiolib/compiler_builtins.h @@ -46,6 +46,27 @@ extern "C" { void __ashlti3(__int128& res, uint64_t lo, uint64_t hi, uint32_t shift); void __ashrti3(__int128& res, uint64_t lo, uint64_t hi, uint32_t shift); + void __addtf3( long double& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + void __subtf3( long double& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + void __multf3( long double& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + void __divtf3( long double& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + int __eqtf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + int __netf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + int __getf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + int __gttf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + int __letf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + int __lttf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + int __cmptf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + int __unordtf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ); + void __extendsftf2( long double& ret, float f ); + void __extenddftf2( long double& ret, double f ); + int64_t __fixtfdi( uint64_t l, uint64_t h ); + int32_t __fixtfsi( uint64_t l, uint64_t h ); + uint64_t __fixunstfdi( uint64_t l, uint64_t h ); + uint32_t __fixunstfsi( uint64_t l, uint64_t h ); + double __trunctfdf2( uint64_t l, uint64_t h ); + float __trunctfsf2( uint64_t l, uint64_t h ); + void __break_point(); } // extern "C" diff --git a/contracts/eosiolib/fixedpoint.hpp b/contracts/eosiolib/fixedpoint.hpp index e2836ef190e995e275826c38e0bd9fedf031399b..5c074fd175ca31e35c6ad8c5cf18c4e0fb1ac87b 100644 --- a/contracts/eosiolib/fixedpoint.hpp +++ b/contracts/eosiolib/fixedpoint.hpp @@ -147,11 +147,11 @@ ope * fixed_point128<3> b(a); */ uint128_t frac_part() const { if(!Q) return 0; - return val << (32-Q); + return uint128_t(val << (32-Q)); } void print() const { - uint128_t ip(int_part()); + uint128_t ip((uint128_t)int_part()); uint128_t fp(frac_part()); printi128(&ip); prints("."); @@ -230,7 +230,7 @@ ope * fixed_point128<3> b(a); */ uint64_t frac_part() const { if(!Q) return 0; - return val << (32-Q); + return uint64_t(val << (32-Q)); } void print() const { @@ -306,7 +306,7 @@ ope * fixed_point128<3> b(a); } uint32_t frac_part() const { if(!Q) return 0; - return val << (32-Q); + return uint32_t(val << (32-Q)); } void print() const { @@ -576,7 +576,7 @@ ope * fixed_point128<3> b(a); { eosio_assert( rhs != 0, "divide by zero" ); - fixed_point64 result = fixed_point32<0>(lhs) / fixed_point32<0>(rhs); + fixed_point64 result = fixed_point32<0>((int32_t)lhs) / fixed_point32<0>((int32_t)rhs); return result; } @@ -595,7 +595,7 @@ ope * fixed_point128<3> b(a); { eosio_assert( rhs != 0, "divide by zero" ); - fixed_point128 result = fixed_point64<0>(lhs) / fixed_point64<0>(rhs); + fixed_point128 result = fixed_point64<0>((int32_t)lhs) / fixed_point64<0>((int32_t)rhs); return fixed_point128(result); } diff --git a/contracts/eosiolib/generic_currency.hpp b/contracts/eosiolib/generic_currency.hpp index d6483c6e02c317ac03156e50fc7a19023d36956f..0467c87a572f7f75f3c89d60eaebd3b8b0e27568 100644 --- a/contracts/eosiolib/generic_currency.hpp +++ b/contracts/eosiolib/generic_currency.hpp @@ -67,12 +67,12 @@ namespace eosio { }; struct currency_stats { - uint64_t symbol = token_type::symbol; token_type supply; + uint64_t symbol = token_type::symbol; auto primary_key() const { return symbol; } - EOSLIB_SERIALIZE( currency_stats, (symbol)(supply) ) + EOSLIB_SERIALIZE( currency_stats, (supply)(symbol) ) }; /** diff --git a/contracts/eosiolib/print.hpp b/contracts/eosiolib/print.hpp index cfe06926535e2d06b051eabaf60b59ca82bb3a9a..a9bd52c9143992e77c2283a5f721ddee88f3157b 100644 --- a/contracts/eosiolib/print.hpp +++ b/contracts/eosiolib/print.hpp @@ -1,4 +1,4 @@ -/** +/** * @file * @copyright defined in eos/LICENSE.txt */ @@ -50,7 +50,7 @@ namespace eosio { } inline void print( long num ) { - printi(num); + printi(uint64_t(num)); } /** diff --git a/contracts/eosiolib/real.hpp b/contracts/eosiolib/real.hpp index 6a6a394d9bebd5718e6546086bc4802a23c3c7a6..c05b087900b7692887eea6d19aa007d5d71e3d76 100644 --- a/contracts/eosiolib/real.hpp +++ b/contracts/eosiolib/real.hpp @@ -30,7 +30,7 @@ namespace eosio { * @brief Constructor to double object from uint64 value * * @details Constructor to double object from uint64 value - * @param val data + * @param _val data */ real(const uint64_t &_val) : val(_val) {} diff --git a/contracts/eosiolib/singleton.hpp b/contracts/eosiolib/singleton.hpp index 83ee38e0d6b19c5e5ae7a516e599908ab6326578..1f9701003c97c631d7a796f7b97c39c44c6e7ee9 100644 --- a/contracts/eosiolib/singleton.hpp +++ b/contracts/eosiolib/singleton.hpp @@ -20,7 +20,7 @@ namespace eosio { uint64_t primary_key() const { return pk_value; } - EOSLIB_SERIALIZE( row, (value) ); + EOSLIB_SERIALIZE( row, (value) ) }; typedef eosio::multi_index table; diff --git a/contracts/identity/identity.hpp b/contracts/identity/identity.hpp index 70919d759d3ed6cd102e43b427144832982ef544..b1dc66a5c3d077d6ad4e271987e5e5c8d8c2243d 100644 --- a/contracts/identity/identity.hpp +++ b/contracts/identity/identity.hpp @@ -155,7 +155,7 @@ namespace identity { uint64_t primary_key() const { return account; } - EOSLIB_SERIALIZE( trustrow, (account) ); + EOSLIB_SERIALIZE( trustrow, (account) ) }; typedef eosio::multi_index { account_name account ; - EOSLIB_SERIALIZE( get_identity_for_account, (account) ); + EOSLIB_SERIALIZE( get_identity_for_account, (account) ) }; typedef singleton result_table; diff --git a/contracts/libc++/upstream b/contracts/libc++/upstream index 959b01fb8b617851e260bd2218ac8ba74269fec9..2880ac42909d4bb29687ed079f8bb4405c3b0869 160000 --- a/contracts/libc++/upstream +++ b/contracts/libc++/upstream @@ -1 +1 @@ -Subproject commit 959b01fb8b617851e260bd2218ac8ba74269fec9 +Subproject commit 2880ac42909d4bb29687ed079f8bb4405c3b0869 diff --git a/contracts/multi_index_test/CMakeLists.txt b/contracts/multi_index_test/CMakeLists.txt index 50606049b242e515fe5b4a6a0f44672f10231885..40a4eef16fdacbfc85ca35878f0665d7fc14191d 100644 --- a/contracts/multi_index_test/CMakeLists.txt +++ b/contracts/multi_index_test/CMakeLists.txt @@ -1,10 +1,8 @@ - file(GLOB ABI_FILES "*.abi") -set(ABI_FILES "multi_index_test.abi") +configure_file("${ABI_FILES}" "${CMAKE_CURRENT_BINARY_DIR}" COPYONLY) add_wast_executable(TARGET multi_index_test INCLUDE_FOLDERS "${STANDARD_INCLUDE_FOLDERS}" LIBRARIES libc++ libc eosiolib DESTINATION_FOLDER ${CMAKE_CURRENT_BINARY_DIR} ) -configure_file("${ABI_FILES}" "${CMAKE_CURRENT_BINARY_DIR}" COPYONLY) diff --git a/contracts/musl/CMakeLists.txt b/contracts/musl/CMakeLists.txt index 30912e0b5084e3c26c768fab95a4e04d6b426912..d9794c311ed3281788d21c1691b8e39c332baadb 100644 --- a/contracts/musl/CMakeLists.txt +++ b/contracts/musl/CMakeLists.txt @@ -4,7 +4,7 @@ file(GLOB ENV_SOURCES "upstream/src/env/*.c") file(GLOB ERRNO_SOURCES "upstream/src/errno/*.c") file(GLOB EXIT_SOURCES "upstream/src/exit/*.c") file(GLOB LOCALE_SOURCES "upstream/src/locale/*.c") -file(GLOB MALLOC_SOURCES "upstream/src/malloc/*.c") +file(GLOB MATH_SOURCES "upstream/src/math/*.c") file(GLOB MBYTE_SOURCES "upstream/src/multibyte/*.c") file(GLOB MISC_SOURCES "upstream/src/misc/*.c") file(GLOB SEARCH_SOURCES "upstream/src/search/*.c") @@ -13,12 +13,12 @@ file(GLOB STDLIB_SOURCES "upstream/src/stdlib/*.c") file(GLOB STRING_SOURCES "upstream/src/string/*.c") file(GLOB TIME_SOURCES "upstream/src/time/*.c") file(GLOB THREAD_SOURCES "upstream/src/thread/*.c") #only for __lock __unlock -set(INTERNAL_SOURCES upstream/src/internal/intscan.c upstream/src/internal/shgetc.c upstream/src/internal/libc.c) +set(INTERNAL_SOURCES upstream/src/internal/floatscan.c upstream/src/internal/intscan.c upstream/src/internal/shgetc.c upstream/src/internal/libc.c) add_wast_library(TARGET libc NOWARNINGS - SOURCE_FILES ${CRYPT_SOURCES} ${CTYPE_SOURCES} ${ENV_SOURCES} ${ERRNO_SOURCES} ${EXIT_SOURCES} ${INTERNAL_SOURCES} ${LOCALE_SOURCES} ${MBYTE_SOURCES} - ${MISC_SOURCES} ${SEARCH_SOURCES} ${STDIO_SOURCES} ${STDLIB_SOURCES} ${STRING_SOURCES} ${TIME_SOURCES} ${THREAD_SOURCES} + SOURCE_FILES ${CRYPT_SOURCES} ${CTYPE_SOURCES} ${ENV_SOURCES} ${ERRNO_SOURCES} ${EXIT_SOURCES} ${INTERNAL_SOURCES} ${LOCALE_SOURCES} ${MATH_SOURCES} + ${MBYTE_SOURCES} ${MISC_SOURCES} ${SEARCH_SOURCES} ${STDIO_SOURCES} ${STDLIB_SOURCES} ${STRING_SOURCES} ${TIME_SOURCES} ${THREAD_SOURCES} INCLUDE_FOLDERS ${CMAKE_SOURCE_DIR}/contracts/musl/upstream/include ${CMAKE_SOURCE_DIR}/contracts/musl/upstream/src/internal ${CMAKE_SOURCE_DIR}/contracts/musl/upstream/arch/eos diff --git a/contracts/musl/upstream b/contracts/musl/upstream index ee49ba896db1de3c3e4f4285eb4e285b641a6cd9..8a34536ac9764c90c86cc0b62d0cda07449fd5d8 160000 --- a/contracts/musl/upstream +++ b/contracts/musl/upstream @@ -1 +1 @@ -Subproject commit ee49ba896db1de3c3e4f4285eb4e285b641a6cd9 +Subproject commit 8a34536ac9764c90c86cc0b62d0cda07449fd5d8 diff --git a/contracts/noop/noop.hpp b/contracts/noop/noop.hpp index 51d71859690b0d68be35a2aa5fd77fa3db023c9b..24bdc61a9f4c8511eb616bf1a1a2ccfffe9656a7 100644 --- a/contracts/noop/noop.hpp +++ b/contracts/noop/noop.hpp @@ -7,8 +7,6 @@ #include #include -using namespace eosio; - namespace noop { using std::string; diff --git a/contracts/simpledb/simpledb.cpp b/contracts/simpledb/simpledb.cpp index 0441a10e04ad29836fc47c69c8b9ae384c0d0b12..aebe16c111838904a860039a028d5c875a665a5c 100644 --- a/contracts/simpledb/simpledb.cpp +++ b/contracts/simpledb/simpledb.cpp @@ -35,7 +35,7 @@ namespace simpledb { int16_t i16; int8_t i8; - EOSLIB_SERIALIZE( record1, (key)(u128)(u64)(u32)(u16)(u8)(i64)(i32)(i16)(i8) ); + EOSLIB_SERIALIZE( record1, (key)(u128)(u64)(u32)(u16)(u8)(i64)(i32)(i16)(i8) ) }; //@abi action insert1 @@ -46,7 +46,7 @@ namespace simpledb { store_i64( N(simpledb), N(record1), N(simpledb), b.data(), b.size()); } - EOSLIB_SERIALIZE( insert_record1, (r1) ); + EOSLIB_SERIALIZE( insert_record1, (r1) ) }; //@abi action remove1 @@ -56,7 +56,7 @@ namespace simpledb { remove_i64( N(simpledb), N(record1), (char *)this); } - EOSLIB_SERIALIZE( remove_record1, (key) ); + EOSLIB_SERIALIZE( remove_record1, (key) ) }; //@abi table @@ -64,7 +64,7 @@ namespace simpledb { uint128_t key1; uint128_t key2; - EOSLIB_SERIALIZE( record2, (key1)(key2) ); + EOSLIB_SERIALIZE( record2, (key1)(key2) ) }; //@abi action insert2 @@ -75,7 +75,7 @@ namespace simpledb { store_i128i128( N(simpledb), N(record2), N(simpledb), b.data(), b.size()); } - EOSLIB_SERIALIZE( insert_record2, (r2) ); + EOSLIB_SERIALIZE( insert_record2, (r2) ) }; //@abi action remove2 @@ -86,7 +86,7 @@ namespace simpledb { remove_i128i128( N(simpledb), N(record2), b.data()); } - EOSLIB_SERIALIZE( remove_record2, (key) ); + EOSLIB_SERIALIZE( remove_record2, (key) ) }; //@abi table @@ -95,7 +95,7 @@ namespace simpledb { uint64_t key2; uint64_t key3; - EOSLIB_SERIALIZE( record3, (key1)(key2)(key3) ); + EOSLIB_SERIALIZE( record3, (key1)(key2)(key3) ) }; //@abi action insert3 @@ -106,7 +106,7 @@ namespace simpledb { store_i128i128( N(simpledb), N(record3), N(simpledb), b.data(), b.size()); } - EOSLIB_SERIALIZE( insert_record3, (r3) ); + EOSLIB_SERIALIZE( insert_record3, (r3) ) }; //@abi action remove3 @@ -117,7 +117,7 @@ namespace simpledb { remove_i64i64i64( N(simpledb), N(record2), b.data()); } - EOSLIB_SERIALIZE( remove_record3, (key) ); + EOSLIB_SERIALIZE( remove_record3, (key) ) }; //@abi table @@ -125,7 +125,7 @@ namespace simpledb { std::string key; std::string value; - EOSLIB_SERIALIZE( key_value1, (key)(value) ); + EOSLIB_SERIALIZE( key_value1, (key)(value) ) }; //@abi action insertkv1 @@ -137,7 +137,7 @@ namespace simpledb { // store_str( N(simpledb), N(keyvalue1), N(simpledb), (char *)kv1.key.data(), kv1.key.size(), b.data(), b.size()); } - EOSLIB_SERIALIZE( insert_keyvalue1, (kv1) ); + EOSLIB_SERIALIZE( insert_keyvalue1, (kv1) ) }; //@abi action removekv1 @@ -148,14 +148,14 @@ namespace simpledb { //remove_str( N(simpledb), N(keyvalue1), (char *)key.data(), key.size() ); } - EOSLIB_SERIALIZE( remove_keyvalue1, (key) ); + EOSLIB_SERIALIZE( remove_keyvalue1, (key) ) }; struct complex_type { std::string name; uint64_t age; - EOSLIB_SERIALIZE( complex_type, (name)(age) ); + EOSLIB_SERIALIZE( complex_type, (name)(age) ) }; //@abi table @@ -163,7 +163,7 @@ namespace simpledb { std::string key; complex_type value; - EOSLIB_SERIALIZE( key_value2, (key)(value) ); + EOSLIB_SERIALIZE( key_value2, (key)(value) ) }; //@abi action insertkv2 @@ -175,7 +175,7 @@ namespace simpledb { // store_str( N(simpledb), N(keyvalue2), N(simpledb), (char *)kv2.key.data(), kv2.key.size(), b.data(), b.size()); } - EOSLIB_SERIALIZE( insert_keyvalue2, (kv2) ); + EOSLIB_SERIALIZE( insert_keyvalue2, (kv2) ) }; //@abi action removekv2 @@ -185,7 +185,7 @@ namespace simpledb { remove_str( N(simpledb), N(keyvalue2), (char *)key.data(), key.size() ); } - EOSLIB_SERIALIZE( remove_keyvalue2, (key) ); + EOSLIB_SERIALIZE( remove_keyvalue2, (key) ) }; template diff --git a/contracts/test.system/test.system.abi b/contracts/test.system/test.system.abi index f967cbb91d4a462d7472a2d34ab6ac04074f3bb3..6c90bc455de09fd181edf035d37af0168a1da9fe 100644 --- a/contracts/test.system/test.system.abi +++ b/contracts/test.system/test.system.abi @@ -13,7 +13,7 @@ "name": "set_global_limits", "base": "", "fields": [ - {"name":"cpu_usec_per_period", "type":"int64"}, + {"name":"cpu_usec_per_period", "type":"int64"} ] },{ "name": "producer_key", @@ -33,7 +33,7 @@ "name": "require_auth", "base": "", "fields": [ - {"name":"from", "type":"account_name"}, + {"name":"from", "type":"account_name"} ] },{ "name": "nonce", @@ -60,4 +60,4 @@ } ], "tables": [] -} \ No newline at end of file +} diff --git a/contracts/test_api/test_action.cpp b/contracts/test_api/test_action.cpp index 6a56f38976b80eb86b5232fcdac7bbecfc32d5c0..5cc77f41ffd205b1b8d0267153d26110a69fe808 100644 --- a/contracts/test_api/test_action.cpp +++ b/contracts/test_api/test_action.cpp @@ -38,11 +38,11 @@ void test_action::read_action_normal() { } void test_action::read_action_to_0() { - uint32_t total = read_action((void *)0, action_size()); + read_action((void *)0, action_size()); } void test_action::read_action_to_64k() { - uint32_t total = read_action( (void *)((1<<16)-2), action_size()); + read_action( (void *)((1<<16)-2), action_size()); } void test_action::require_notice() { diff --git a/contracts/test_api/test_api.cpp b/contracts/test_api/test_api.cpp index e35aed786e0d24131353dc1f6b17ba8c90e65b44..bf12f1352edb5932fcd57b7289004217961fa55a 100644 --- a/contracts/test_api/test_api.cpp +++ b/contracts/test_api/test_api.cpp @@ -23,7 +23,7 @@ extern "C" { } - void apply( unsigned long long code, unsigned long long action ) { + void apply( unsigned long long, unsigned long long action ) { //eosio::print("==> CONTRACT: ", code, " ", action, "\n"); //test_types WASM_TEST_HANDLER(test_types, types_size); diff --git a/contracts/test_api/test_api.hpp b/contracts/test_api/test_api.hpp index 9396223728023008e774daf191f955970dadd324..0beaa3ee2d8d507e241352a814740a7b657266cd 100644 --- a/contracts/test_api/test_api.hpp +++ b/contracts/test_api/test_api.hpp @@ -69,7 +69,7 @@ struct test_action { static void assert_false(); static void assert_true(); static void now(); - static void test_abort(); + static void test_abort() __attribute__ ((noreturn)) ; static void test_current_receiver(); static void test_current_sender(); static void test_publication_time(); diff --git a/contracts/test_api/test_compiler_builtins.cpp b/contracts/test_api/test_compiler_builtins.cpp index 284094adc061cc506db0141f2b17f621f87ee0bb..1492110b82e02932dd70a42dca53ba8026038294 100644 --- a/contracts/test_api/test_compiler_builtins.cpp +++ b/contracts/test_api/test_compiler_builtins.cpp @@ -9,7 +9,6 @@ #include "test_api.hpp" -using namespace eosio; unsigned __int128 operator "" _ULLL( const char* lit ) { __int128 ret = 0; size_t i = 0; @@ -32,7 +31,7 @@ unsigned __int128 operator "" _ULLL( const char* lit ) { if (sign) ret *= -1; - return ret; + return (unsigned __int128)ret; } __int128 operator "" _LLL( const char* lit ) { @@ -70,28 +69,28 @@ void test_compiler_builtins::test_multi3() { __int128 lhs_b = 100; __int128 rhs_b = -30; - __multi3( res, lhs_a, ( lhs_a >> 64 ), rhs_a, ( rhs_a >> 64 ) ); + __multi3( res, uint64_t(lhs_a), uint64_t( lhs_a >> 64 ), uint64_t(rhs_a), uint64_t( rhs_a >> 64 ) ); eosio_assert( res == -3000, "__multi3 result should be -3000" ); - __multi3( res, lhs_b, ( lhs_b >> 64 ), rhs_b, ( rhs_b >> 64 ) ); + __multi3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), uint64_t(rhs_b), uint64_t( rhs_b >> 64 ) ); eosio_assert( res == -3000, "__multi3 result should be -3000" ); - __multi3( res, lhs_a, ( lhs_a >> 64 ), rhs_b, ( rhs_b >> 64 ) ); + __multi3( res, uint64_t(lhs_a), uint64_t( lhs_a >> 64 ), uint64_t(rhs_b), uint64_t( rhs_b >> 64 ) ); eosio_assert( res == 900, "__multi3 result should be 900" ); /* * test for positive values */ - __multi3( res, lhs_b, ( lhs_b >> 64 ), rhs_a, ( rhs_a >> 64 ) ); + __multi3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), uint64_t(rhs_a), uint64_t( rhs_a >> 64 ) ); eosio_assert( res == 10000, "__multi3 result should be 10000" ); /* * test identity */ - __multi3( res, 1, 0, rhs_a, rhs_a >> 64 ); + __multi3( res, 1, 0, uint64_t(rhs_a), uint64_t(rhs_a >> 64) ); eosio_assert( res == 100, "__multi3 result should be 100" ); - __multi3( res, 1, 0, rhs_b, rhs_b >> 64 ); + __multi3( res, 1, 0, uint64_t(rhs_b), uint64_t(rhs_b >> 64) ); eosio_assert( res == -30, "__multi3 result should be -30" ); } @@ -105,13 +104,13 @@ void test_compiler_builtins::test_divti3() { __int128 lhs_b = 100; __int128 rhs_b = -30; - __divti3( res, lhs_a, ( lhs_a >> 64 ), rhs_a, ( rhs_a >> 64 ) ); + __divti3( res, uint64_t(lhs_a), uint64_t( lhs_a >> 64 ), uint64_t(rhs_a), uint64_t( rhs_a >> 64 ) ); eosio_assert( res == 0, "__divti3 result should be 0" ); - __divti3( res, lhs_b, ( lhs_b >> 64 ), rhs_b, ( rhs_b >> 64 ) ); + __divti3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), uint64_t(rhs_b), uint64_t( rhs_b >> 64 ) ); eosio_assert( res == -3, "__divti3 result should be -3" ); - __divti3( res, lhs_a, ( lhs_a >> 64 ), rhs_b, ( rhs_b >> 64 ) ); + __divti3( res, uint64_t(lhs_a), uint64_t( lhs_a >> 64 ), uint64_t(rhs_b), uint64_t( rhs_b >> 64 ) ); eosio_assert( res == 1, "__divti3 result should be 1" ); /* @@ -120,22 +119,22 @@ void test_compiler_builtins::test_divti3() { __int128 lhs_c = 3333; __int128 rhs_c = 3333; - __divti3( res, lhs_b, ( lhs_b >> 64 ), rhs_a, ( rhs_a >> 64 ) ); + __divti3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), uint64_t(rhs_a), uint64_t( rhs_a >> 64 ) ); eosio_assert( res == 1, "__divti3 result should be 1" ); - __divti3( res, lhs_b, ( lhs_b >> 64 ), rhs_c, ( rhs_c >> 64 ) ); + __divti3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), uint64_t(rhs_c), uint64_t( rhs_c >> 64 ) ); eosio_assert( res == 0, "__divti3 result should be 0" ); - __divti3( res, lhs_c, ( lhs_c >> 64 ), rhs_a, ( rhs_a >> 64 ) ); + __divti3( res, uint64_t(lhs_c), uint64_t( lhs_c >> 64 ), uint64_t(rhs_a), uint64_t( rhs_a >> 64 ) ); eosio_assert( res == 33, "__divti3 result should be 33" ); /* * test identity */ - __divti3( res, lhs_b, ( lhs_b >> 64 ), 1, 0 ); + __divti3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), 1, 0 ); eosio_assert( res == 100, "__divti3 result should be 100" ); - __divti3( res, lhs_a, ( lhs_a >> 64 ), 1, 0 ); + __divti3( res, uint64_t(lhs_a), uint64_t( lhs_a >> 64 ), 1, 0 ); eosio_assert( res == -30, "__divti3 result should be -30" ); } @@ -147,22 +146,22 @@ void test_compiler_builtins::test_divti3_by_0() { } void test_compiler_builtins::test_udivti3() { - /* + /* * test for negative values */ unsigned __int128 res = 0; - unsigned __int128 lhs_a = -30; + unsigned __int128 lhs_a = (unsigned __int128)-30; unsigned __int128 rhs_a = 100; unsigned __int128 lhs_b = 100; - unsigned __int128 rhs_b = -30; + unsigned __int128 rhs_b = (unsigned __int128)-30; - __udivti3( res, lhs_a, ( lhs_a >> 64 ), rhs_a, ( rhs_a >> 64 ) ); + __udivti3( res, uint64_t(lhs_a), uint64_t( lhs_a >> 64 ), uint64_t(rhs_a), uint64_t( rhs_a >> 64 ) ); eosio_assert( res == 3402823669209384634633746074317682114_ULLL, "__udivti3 result should be 0" ); - __udivti3( res, lhs_b, ( lhs_b >> 64 ), rhs_b, ( rhs_b >> 64 ) ); + __udivti3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), uint64_t(rhs_b), uint64_t( rhs_b >> 64 ) ); eosio_assert( res == 0, "__udivti3 result should be 0" ); - __udivti3( res, lhs_a, ( lhs_a >> 64 ), rhs_b, ( rhs_b >> 64 ) ); + __udivti3( res, uint64_t(lhs_a), uint64_t( lhs_a >> 64 ), uint64_t(rhs_b), uint64_t( rhs_b >> 64 ) ); eosio_assert( res == 1, "__udivti3 result should be 1" ); /* @@ -171,23 +170,23 @@ void test_compiler_builtins::test_udivti3() { __int128 lhs_c = 3333; __int128 rhs_c = 3333; - __udivti3( res, lhs_b, ( lhs_b >> 64 ), rhs_a, ( rhs_a >> 64 ) ); + __udivti3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), uint64_t(rhs_a), uint64_t( rhs_a >> 64 ) ); eosio_assert( res == 1, "__divti3 result should be 1" ); - __udivti3( res, lhs_b, ( lhs_b >> 64 ), rhs_c, ( rhs_c >> 64 ) ); + __udivti3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), uint64_t(rhs_c), uint64_t( rhs_c >> 64 ) ); eosio_assert( res == 0, "__divti3 result should be 0" ); - __udivti3( res, lhs_c, ( lhs_c >> 64 ), rhs_a, ( rhs_a >> 64 ) ); + __udivti3( res, uint64_t(lhs_c), uint64_t( lhs_c >> 64 ), uint64_t(rhs_a), uint64_t( rhs_a >> 64 ) ); eosio_assert( res == 33, "__divti3 result should be 33" ); /* * test identity */ - __udivti3( res, lhs_b, ( lhs_b >> 64 ), 1, 0 ); + __udivti3( res, uint64_t(lhs_b), uint64_t( lhs_b >> 64 ), 1, 0 ); eosio_assert( res == 100, "__divti3 result should be 100" ); - __udivti3( res, lhs_a, ( lhs_a >> 64 ), 1, 0 ); - eosio_assert( res == -30, "__divti3 result should be -30" ); + __udivti3( res, uint64_t(lhs_a), uint64_t( lhs_a >> 64 ), 1, 0 ); + eosio_assert( res == (unsigned __int128)-30, "__divti3 result should be -30" ); } void test_compiler_builtins::test_udivti3_by_0() { @@ -207,27 +206,27 @@ void test_compiler_builtins::test_lshlti3() { test_res <<= 1; - __lshlti3( res, val, val >> 64, 0 ); + __lshlti3( res, uint64_t(val), uint64_t(val >> 64), 0 ); eosio_assert( res == 1, "__lshlti3 result should be 1" ); - __lshlti3( res, val, val >> 64, 1 ); + __lshlti3( res, uint64_t(val), uint64_t(val >> 64), 1 ); eosio_assert( res == ( 1 << 1 ), "__lshlti3 result should be 2" ); - __lshlti3( res, val, ( val >> 64 ), 31 ); - eosio_assert( res == 2147483648_ULLL, "__lshlti3 result should be 2^31" ); + __lshlti3( res, uint64_t(val), uint64_t( val >> 64 ), 31 ); + eosio_assert( (unsigned __int128)res == 2147483648_ULLL, "__lshlti3 result should be 2^31" ); - __lshlti3( res, val, ( val >> 64 ), 63 ); - eosio_assert( res == 9223372036854775808_ULLL, "__lshlti3 result should be 2^63" ); + __lshlti3( res, uint64_t(val), uint64_t( val >> 64 ), 63 ); + eosio_assert( (unsigned __int128)res == 9223372036854775808_ULLL, "__lshlti3 result should be 2^63" ); - __lshlti3( res, val, ( val >> 64 ), 64 ); + __lshlti3( res, uint64_t(val), uint64_t( val >> 64 ), 64 ); eosio_assert( res == test_res, "__lshlti3 result should be 2^64" ); - __lshlti3( res, val, ( val >> 64 ), 127 ); + __lshlti3( res, uint64_t(val), uint64_t( val >> 64 ), 127 ); test_res <<= 63; eosio_assert( res == test_res, "__lshlti3 result should be 2^127" ); - __lshlti3( res, val, ( val >> 64 ), 128 ); + __lshlti3( res, uint64_t(val), uint64_t( val >> 64 ), 128 ); test_res <<= 1; //should rollover eosio_assert( res == test_res, "__lshlti3 result should be 2^128" ); @@ -241,27 +240,27 @@ void test_compiler_builtins::test_ashlti3() { test_res = 0x8000000000000000; test_res <<= 1; - __ashlti3( res, val, val >> 64, 0 ); + __ashlti3( res, uint64_t(val), uint64_t(val >> 64), 0 ); eosio_assert( res == 1, "__ashlti3 result should be 1" ); - __ashlti3( res, val, val >> 64, 1 ); + __ashlti3( res, uint64_t(val), uint64_t(val >> 64), 1 ); eosio_assert( res == (1 << 1), "__ashlti3 result should be 2" ); - __ashlti3( res, val, (val >> 64), 31 ); - eosio_assert( res == 2147483648_ULLL, "__ashlti3 result should be 2^31" ); + __ashlti3( res, uint64_t(val), uint64_t(val >> 64), 31 ); + eosio_assert( res == (__int128)2147483648_ULLL, "__ashlti3 result should be 2^31" ); - __ashlti3( res, val, (val >> 64), 63 ); - eosio_assert( res == 9223372036854775808_ULLL, "__ashlti3 result should be 2^63" ); + __ashlti3( res, uint64_t(val), uint64_t(val >> 64), 63 ); + eosio_assert( res == (__int128)9223372036854775808_ULLL, "__ashlti3 result should be 2^63" ); - __ashlti3( res, val, (val >> 64), 64 ); + __ashlti3( res, uint64_t(val), uint64_t(val >> 64), 64 ); eosio_assert( res == test_res, "__ashlti3 result should be 2^64" ); - __ashlti3( res, val, (val >> 64), 127 ); + __ashlti3( res, uint64_t(val), uint64_t(val >> 64), 127 ); test_res <<= 63; eosio_assert( res == test_res, "__ashlti3 result should be 2^127" ); - __ashlti3( res, val, (val >> 64), 128 ); + __ashlti3( res, uint64_t(val), uint64_t(val >> 64), 128 ); test_res <<= 1; //should rollover eosio_assert( res == test_res, "__ashlti3 result should be 2^128" ); @@ -276,22 +275,22 @@ void test_compiler_builtins::test_lshrti3() { val <<= 64; test_res <<= 64; - __lshrti3( res, val, (val >> 64), 0 ); + __lshrti3( res, uint64_t(val), uint64_t(val >> 64), 0 ); eosio_assert( res == test_res, "__lshrti3 result should be 2^127" ); - __lshrti3( res, val, (val >> 64), 1 ); - eosio_assert( res == 85070591730234615865843651857942052864_ULLL, "__lshrti3 result should be 2^126" ); + __lshrti3( res, uint64_t(val), uint64_t(val >> 64), 1 ); + eosio_assert( res == (__int128)85070591730234615865843651857942052864_ULLL, "__lshrti3 result should be 2^126" ); - __lshrti3( res, val, (val >> 64), 63 ); - eosio_assert( res == 18446744073709551616_ULLL, "__lshrti3 result should be 2^64" ); + __lshrti3( res, uint64_t(val), uint64_t(val >> 64), 63 ); + eosio_assert( res == (__int128)18446744073709551616_ULLL, "__lshrti3 result should be 2^64" ); - __lshrti3( res, val, (val >> 64), 64 ); - eosio_assert( res == 9223372036854775808_ULLL, "__lshrti3 result should be 2^63" ); + __lshrti3( res, uint64_t(val), uint64_t(val >> 64), 64 ); + eosio_assert( res == (__int128)9223372036854775808_ULLL, "__lshrti3 result should be 2^63" ); - __lshrti3( res, val, (val >> 64), 96 ); - eosio_assert( res == 2147483648_ULLL, "__lshrti3 result should be 2^31" ); + __lshrti3( res, uint64_t(val), uint64_t(val >> 64), 96 ); + eosio_assert( res == (__int128)2147483648_ULLL, "__lshrti3 result should be 2^31" ); - __lshrti3( res, val, (val >> 64), 127 ); + __lshrti3( res, uint64_t(val), uint64_t(val >> 64), 127 ); eosio_assert( res == 0x1, "__lshrti3 result should be 2^0" ); } @@ -302,22 +301,22 @@ void test_compiler_builtins::test_ashrti3() { test <<= 127; - __ashrti3( res, val, (val >> 64), 0 ); + __ashrti3( res, uint64_t(val), uint64_t(val >> 64), 0 ); eosio_assert( res == -170141183460469231731687303715884105728_LLL, "__ashrti3 result should be -2^127" ); - __ashrti3(res, val, (val >> 64), 1 ); + __ashrti3(res, uint64_t(val), uint64_t(val >> 64), 1 ); eosio_assert( res == -85070591730234615865843651857942052864_LLL, "__ashrti3 result should be -2^126" ); - __ashrti3(res, val, (val >> 64), 2 ); + __ashrti3(res, uint64_t(val), uint64_t(val >> 64), 2 ); eosio_assert( res == test >> 2, "__ashrti3 result should be -2^125" ); - __ashrti3( res, val, (val >> 64), 64 ); + __ashrti3( res, uint64_t(val), uint64_t(val >> 64), 64 ); eosio_assert( res == test >> 64, "__ashrti3 result should be -2^63" ); - __ashrti3( res, val, (val >> 64), 95 ); + __ashrti3( res, uint64_t(val), uint64_t(val >> 64), 95 ); eosio_assert( res == test >> 95, "__ashrti3 result should be -2^31" ); - __ashrti3( res, val, (val >> 64), 127 ); + __ashrti3( res, uint64_t(val), uint64_t(val >> 64), 127 ); eosio_assert( res == test >> 127, "__ashrti3 result should be -2^0" ); } @@ -329,25 +328,25 @@ void test_compiler_builtins::test_modti3() { __int128 lhs_b = 30; __int128 rhs_b = -100; - __modti3( res, lhs_a, lhs_a >> 64, rhs_a, rhs_a >> 64 ); + __modti3( res, uint64_t(lhs_a), uint64_t(lhs_a >> 64), uint64_t(rhs_a), uint64_t(rhs_a >> 64) ); eosio_assert( res == -30, "__modti3 result should be -30" ); - __modti3( res, lhs_b, lhs_b >> 64, rhs_b, rhs_b >> 64 ); + __modti3( res, uint64_t(lhs_b), uint64_t(lhs_b >> 64), uint64_t(rhs_b), uint64_t(rhs_b >> 64) ); eosio_assert( res == 30, "__modti3 result should be 30" ); - __modti3( res, lhs_a, lhs_a >> 64, rhs_b, rhs_b >> 64 ); + __modti3( res, uint64_t(lhs_a), uint64_t(lhs_a >> 64), uint64_t(rhs_b), uint64_t(rhs_b >> 64) ); eosio_assert( res == -30, "__modti3 result should be -30" ); - __modti3( res, rhs_a, rhs_a >> 64, lhs_b, lhs_b >> 64 ); + __modti3( res, uint64_t(rhs_a), uint64_t(rhs_a >> 64), uint64_t(lhs_b), uint64_t(lhs_b >> 64) ); eosio_assert( res == 10, "__modti3 result should be 10" ); - __modti3( res, rhs_a, rhs_a >> 64, rhs_b, rhs_b >> 64 ); + __modti3( res, uint64_t(rhs_a), uint64_t(rhs_a >> 64), uint64_t(rhs_b), uint64_t(rhs_b >> 64) ); eosio_assert( res == 0, "__modti3 result should be 0" ); - __modti3( res, rhs_a, rhs_a >> 64, rhs_a, rhs_a >> 64 ); + __modti3( res, uint64_t(rhs_a), uint64_t(rhs_a >> 64), uint64_t(rhs_a), uint64_t(rhs_a >> 64) ); eosio_assert( res == 0, "__modti3 result should be 0" ); - __modti3( res, 0, 0, rhs_a, rhs_a >> 64 ); + __modti3( res, 0, 0, uint64_t(rhs_a), uint64_t(rhs_a >> 64) ); eosio_assert( res == 0, "__modti3 result should be 0" ); } @@ -355,36 +354,36 @@ void test_compiler_builtins::test_modti3_by_0() { __int128 res = 0; __int128 lhs = 100; - __modti3( res, lhs, lhs >> 64, 0, 0 ); + __modti3( res, uint64_t(lhs), uint64_t(lhs >> 64), 0, 0 ); eosio_assert( false, "should have thrown an error" ); } void test_compiler_builtins::test_umodti3() { unsigned __int128 res = 0; - unsigned __int128 lhs_a = -30; + unsigned __int128 lhs_a = (unsigned __int128)-30; unsigned __int128 rhs_a = 100; unsigned __int128 lhs_b = 30; - unsigned __int128 rhs_b = -100; + unsigned __int128 rhs_b = (unsigned __int128)-100; - __umodti3( res, lhs_a, lhs_a >> 64, rhs_a, rhs_a >> 64 ); - eosio_assert( res == -30, "__modti3 result should be -30" ); + __umodti3( res, uint64_t(lhs_a), uint64_t(lhs_a >> 64), uint64_t(rhs_a), uint64_t(rhs_a >> 64) ); + eosio_assert( res == (unsigned __int128)-30, "__modti3 result should be -30" ); - __umodti3( res, lhs_b, lhs_b >> 64, rhs_b, rhs_b >> 64 ); + __umodti3( res, uint64_t(lhs_b), uint64_t(lhs_b >> 64), uint64_t(rhs_b), uint64_t(rhs_b >> 64) ); eosio_assert( res == 30, "__modti3 result should be 30" ); - __umodti3( res, lhs_a, lhs_a >> 64, rhs_b, rhs_b >> 64 ); - eosio_assert( res == -30, "__modti3 result should be -30" ); + __umodti3( res, uint64_t(lhs_a), uint64_t(lhs_a >> 64), uint64_t(rhs_b), uint64_t(rhs_b >> 64) ); + eosio_assert( res == (unsigned __int128)-30, "__modti3 result should be -30" ); - __umodti3( res, rhs_a, rhs_a >> 64, lhs_b, lhs_b >> 64 ); + __umodti3( res, uint64_t(rhs_a), uint64_t(rhs_a >> 64), uint64_t(lhs_b), uint64_t(lhs_b >> 64) ); eosio_assert( res == 10, "__modti3 result should be 10" ); - __umodti3( res, rhs_a, rhs_a >> 64, rhs_b, rhs_b >> 64 ); + __umodti3( res, uint64_t(rhs_a), uint64_t(rhs_a >> 64), uint64_t(rhs_b), uint64_t(rhs_b >> 64) ); eosio_assert( res == 0, "__modti3 result should be 0" ); - __umodti3( res, rhs_a, rhs_a >> 64, rhs_a, rhs_a >> 64 ); + __umodti3( res, uint64_t(rhs_a), uint64_t(rhs_a >> 64), uint64_t(rhs_a), uint64_t(rhs_a >> 64) ); eosio_assert( res == 0, "__modti3 result should be 0" ); - __umodti3( res, 0, 0, rhs_a, rhs_a >> 64 ); + __umodti3( res, 0, 0, uint64_t(rhs_a), uint64_t(rhs_a >> 64) ); eosio_assert( res == 0, "__modti3 result should be 0" ); } @@ -392,6 +391,6 @@ void test_compiler_builtins::test_umodti3_by_0() { unsigned __int128 res = 0; unsigned __int128 lhs = 100; - __umodti3( res, lhs, lhs >> 64, 0, 0 ); + __umodti3( res, uint64_t(lhs), uint64_t(lhs >> 64), 0, 0 ); eosio_assert( false, "should have thrown an error" ); } diff --git a/contracts/test_api/test_crypto.cpp b/contracts/test_api/test_crypto.cpp index ce703a0d63958bf3a213c6c4d1f90e6982f4bab7..508f0d5684d61589bc2c7d928009f27f8e12c4dc 100644 --- a/contracts/test_api/test_crypto.cpp +++ b/contracts/test_api/test_crypto.cpp @@ -193,24 +193,23 @@ struct sig_hash_key { void test_crypto::test_recover_key_assert_true() { sig_hash_key sh; - int read = read_action( (char*)&sh, sizeof(sh) ); - public_key public_key; + read_action( (char*)&sh, sizeof(sh) ); assert_recover_key( &sh.hash, (const char*)&sh.sig, sizeof(sh.sig), (const char*)&sh.pk, sizeof(sh.pk) ); } void test_crypto::test_recover_key_assert_false() { sig_hash_key sh; - int read = read_action( (char*)&sh, sizeof(sh) ); + read_action( (char*)&sh, sizeof(sh) ); assert_recover_key( &sh.hash, (const char*)&sh.sig, sizeof(sh.sig), (const char*)&sh.pk, sizeof(sh.pk) ); eosio_assert( false, "should have thrown an error" ); } void test_crypto::test_recover_key() { sig_hash_key sh; - int read = read_action( (char*)&sh, sizeof(sh) ); + read_action( (char*)&sh, sizeof(sh) ); public_key pk; - int recovered = recover_key( &sh.hash, (const char*)&sh.sig, sizeof(sh.sig), pk.data, sizeof(pk) ); - for ( int i=0; i < sizeof(pk); i++ ) + recover_key( &sh.hash, (const char*)&sh.sig, sizeof(sh.sig), pk.data, sizeof(pk) ); + for ( uint32_t i=0; i < sizeof(pk); i++ ) if ( pk.data[i] != sh.pk.data[i] ) eosio_assert( false, "public key does not match" ); } @@ -284,8 +283,6 @@ void test_crypto::test_ripemd160() { void test_crypto::sha256_null() { checksum256 tmp; - int a = 3; - int* b = &a; sha256(nullptr, 100, &tmp); //eosio_assert(false, "should've thrown an error"); } diff --git a/contracts/test_api/test_fixedpoint.cpp b/contracts/test_api/test_fixedpoint.cpp index 0a0f163b537cc413d8eb9a991a07d603764caf3c..3f7c02607861ab854a775545ea67934d0f407186 100644 --- a/contracts/test_api/test_fixedpoint.cpp +++ b/contracts/test_api/test_fixedpoint.cpp @@ -2,85 +2,85 @@ #include #include "test_api.hpp" -using namespace eosio; + void test_fixedpoint::create_instances() { { // Various ways to create fixed_point128 - fixed_point128<18> a(12345667); - fixed_point128<18> b(12345667); - fixed_point128<16> c(12345667); - eosio_assert(b == a, "fixed_point128 instances comparison with same number of decimals"); - eosio_assert(c == a, "fixed_point128 instances with different number of decimals"); + eosio::fixed_point128<18> a(12345667); + eosio::fixed_point128<18> b(12345667); + eosio::fixed_point128<16> c(12345667); + eosio_assert(b == a, "fixed_point128 instances comparison with same number of decimals"); + eosio_assert(c == a, "fixed_point128 instances with different number of decimals"); } { // Various ways to create fixed_point64 - fixed_point64<5> a(12345667); - fixed_point64<5> b(12345667); - fixed_point64<5> c(12345667); - eosio_assert(b == a, "fixed_point64 instances comparison with same number of decimals"); - eosio_assert(c == a, "fixed_point64 instances with different number of decimals"); + eosio::fixed_point64<5> a(12345667); + eosio::fixed_point64<5> b(12345667); + eosio::fixed_point64<5> c(12345667); + eosio_assert(b == a, "fixed_point64 instances comparison with same number of decimals"); + eosio_assert(c == a, "fixed_point64 instances with different number of decimals"); } { // Various ways to create fixed_point32 - fixed_point32<18> a(12345667); - fixed_point32<18> b(12345667); - fixed_point32<16> c(12345667); - eosio_assert(b == a, "fixed_point32 instances comparison with same number of decimals"); - eosio_assert(c == a, "fixed_point32 instances with different number of decimals"); + eosio::fixed_point32<18> a(12345667); + eosio::fixed_point32<18> b(12345667); + eosio::fixed_point32<16> c(12345667); + eosio_assert(b == a, "fixed_point32 instances comparison with same number of decimals"); + eosio_assert(c == a, "fixed_point32 instances with different number of decimals"); } } void test_fixedpoint::test_addition() { { - // Various ways to create fixed_point32 - fixed_point32<0> a(100); - fixed_point32<0> b(100); - fixed_point32<0> c = a + b; - fixed_point32<0> d = 200; - eosio_assert(c == d, "fixed_point32 instances addition with zero decmimals"); + // Various ways to create fixed_point32 + eosio::fixed_point32<0> a(100); + eosio::fixed_point32<0> b(100); + eosio::fixed_point32<0> c = a + b; + eosio::fixed_point32<0> d = 200; + eosio_assert(c == d, "fixed_point32 instances addition with zero decmimals"); } { - // Various ways to create fixed_point64 - fixed_point64<0> a(100); - fixed_point64<0> b(100); - fixed_point64<0> c = a + b; - fixed_point64<0> d = 200; - eosio_assert(c == d, "fixed_point64 instances addition with zero decmimals"); + // Various ways to create fixed_point64 + eosio::fixed_point64<0> a(100); + eosio::fixed_point64<0> b(100); + eosio::fixed_point64<0> c = a + b; + eosio::fixed_point64<0> d = 200; + eosio_assert(c == d, "fixed_point64 instances addition with zero decmimals"); } }; void test_fixedpoint::test_subtraction() { { - // Various ways to create fixed_point64 - fixed_point64<0> a(100); - fixed_point64<0> b(100); - fixed_point64<0> c = a - b; - fixed_point64<0> d = 0; - eosio_assert(c == d, "fixed_point64 instances subtraction with zero decmimals"); - - fixed_point64<0> a1(0); - fixed_point64<0> c1 = a1 - b; - fixed_point64<0> d1 = -100; - eosio_assert(c1 == d1, "fixed_point64 instances subtraction with zero decmimals"); + // Various ways to create fixed_point64 + eosio::fixed_point64<0> a(100); + eosio::fixed_point64<0> b(100); + eosio::fixed_point64<0> c = a - b; + eosio::fixed_point64<0> d = 0; + eosio_assert(c == d, "fixed_point64 instances subtraction with zero decmimals"); + + eosio::fixed_point64<0> a1(0); + eosio::fixed_point64<0> c1 = a1 - b; + eosio::fixed_point64<0> d1 = -100; + eosio_assert(c1 == d1, "fixed_point64 instances subtraction with zero decmimals"); } { - // Various ways to create fixed_point32 - fixed_point32<0> a(100); - fixed_point32<0> b(100); - fixed_point32<0> c = a - b; - fixed_point32<0> d = 0; - eosio_assert(c == d, "fixed_point32 instances subtraction with zero decmimals"); - - // Various ways to create fixed_point32 - fixed_point32<0> a1(0); - fixed_point32<0> c1 = a1 - b; - fixed_point32<0> d1 = -100; - eosio_assert(c1 == d1, "fixed_point32 instances subtraction with zero decmimals"); + // Various ways to create fixed_point32 + eosio::fixed_point32<0> a(100); + eosio::fixed_point32<0> b(100); + eosio::fixed_point32<0> c = a - b; + eosio::fixed_point32<0> d = 0; + eosio_assert(c == d, "fixed_point32 instances subtraction with zero decmimals"); + + // Various ways to create fixed_point32 + eosio::fixed_point32<0> a1(0); + eosio::fixed_point32<0> c1 = a1 - b; + eosio::fixed_point32<0> d1 = -100; + eosio_assert(c1 == d1, "fixed_point32 instances subtraction with zero decmimals"); } }; @@ -88,21 +88,21 @@ void test_fixedpoint::test_subtraction() void test_fixedpoint::test_multiplication() { { - // Various ways to create fixed_point64 - fixed_point64<0> a(100); - fixed_point64<0> b(200); - fixed_point128<0> c = a * b; - fixed_point128<0> d(200*100); - eosio_assert(c == d, "fixed_point64 instances multiplication result in fixed_point128"); + // Various ways to create fixed_point64 + eosio::fixed_point64<0> a(100); + eosio::fixed_point64<0> b(200); + eosio::fixed_point128<0> c = a * b; + eosio::fixed_point128<0> d(200*100); + eosio_assert(c == d, "fixed_point64 instances multiplication result in fixed_point128"); } { - // Various ways to create fixed_point32 - fixed_point32<0> a(100); - fixed_point32<0> b(200); - fixed_point64<0> c = a * b; - fixed_point64<0> d(200*100); - eosio_assert(c == d, "fixed_point32 instances multiplication result in fixed_point64"); + // Various ways to create fixed_point32 + eosio::fixed_point32<0> a(100); + eosio::fixed_point32<0> b(200); + eosio::fixed_point64<0> c = a * b; + eosio::fixed_point64<0> d(200*100); + eosio_assert(c == d, "fixed_point32 instances multiplication result in fixed_point64"); } } @@ -112,11 +112,11 @@ void test_fixedpoint::test_division() uint64_t lhs = 10000000; uint64_t rhs = 333; - fixed_point64<0> a(lhs); - fixed_point64<0> b(rhs); - fixed_point128<5> c = a / b; + eosio::fixed_point64<0> a((int64_t)lhs); + eosio::fixed_point64<0> b((int64_t)rhs); + eosio::fixed_point128<5> c = a / b; - fixed_point128<5> e = fixed_divide<5>(lhs, rhs); + eosio::fixed_point128<5> e = eosio::fixed_divide<5>(lhs, rhs); print(e); eosio_assert(c == e, "fixed_point64 instances division result from operator and function and compare in fixed_point128"); @@ -126,11 +126,11 @@ void test_fixedpoint::test_division() uint32_t lhs = 100000; uint32_t rhs = 33; - fixed_point32<0> a(lhs); - fixed_point32<0> b(rhs); - fixed_point64<5> c = a / b; + eosio::fixed_point32<0> a((int32_t)lhs); + eosio::fixed_point32<0> b((int32_t)rhs); + eosio::fixed_point64<5> c = a / b; - fixed_point64<5> e = fixed_divide<5>(lhs, rhs); + eosio::fixed_point64<5> e = eosio::fixed_divide<5>(lhs, rhs); eosio_assert(c == e, "fixed_point64 instances division result from operator and function and compare in fixed_point128"); } @@ -142,10 +142,12 @@ void test_fixedpoint::test_division_by_0() uint64_t lhs = 10000000; uint64_t rhs = 0; - fixed_point64<0> a(lhs); - fixed_point64<0> b(rhs); + eosio::fixed_point64<0> a((int64_t)lhs); + eosio::fixed_point64<0> b((int64_t)rhs); - fixed_point128<5> e = fixed_divide<5>(lhs, rhs); + eosio::fixed_point128<5> e = eosio::fixed_divide<5>(lhs, rhs); + // in order to get rid of unused parameter warning + e = 0; eosio_assert(false, "should've thrown an error"); } diff --git a/contracts/test_api/test_math.cpp b/contracts/test_api/test_math.cpp index f080474b4343407921ce038c67277807a991a928..7b43138778db0b11410b06178f08330774a10cdb 100644 --- a/contracts/test_api/test_math.cpp +++ b/contracts/test_api/test_math.cpp @@ -4,8 +4,6 @@ #include "test_api.hpp" -using namespace eosio; - void test_math::test_multeq() { u128_action act; auto n = read_action(&act, sizeof(u128_action)); @@ -44,13 +42,13 @@ void test_math::test_i64_to_double() uint64_t d = i64_to_double(2); eosio_assert(i[0] == d, "test_i64_to_double i[0] == d"); - d = i64_to_double(-2); + d = i64_to_double(uint64_t(-2)); eosio_assert(i[1] == d, "test_i64_to_double i[1] == d"); d = i64_to_double(100000); eosio_assert(i[2] == d, "test_i64_to_double i[2] == d"); - d = i64_to_double(-100000); + d = i64_to_double(uint64_t(-100000)); eosio_assert(i[3] == d, "test_i64_to_double i[3] == d"); d = i64_to_double(0); @@ -62,19 +60,19 @@ void test_math::test_double_to_i64() uint64_t d[4]; read_action(&d, sizeof(d)); - int64_t i = double_to_i64(d[0]); + int64_t i = (int64_t)double_to_i64(d[0]); eosio_assert(2 == i, "test_double_to_i64 2 == i"); - i = double_to_i64(d[1]); + i = (int64_t)double_to_i64(d[1]); eosio_assert(-2 == i, "test_double_to_i64 -2 == i"); - i = double_to_i64(d[2]); + i = (int64_t)double_to_i64(d[2]); eosio_assert(100000 == i, "test_double_to_i64 100000 == i"); - i = double_to_i64(d[3]); + i = (int64_t)double_to_i64(d[3]); eosio_assert(-100000 == i, "test_double_to_i64 -100000 == i"); - i = double_to_i64(0); + i = (int64_t)double_to_i64(0); eosio_assert(0 == i, "test_double_to_i64 0 == i"); } @@ -112,7 +110,7 @@ void test_math::test_double_api() { void test_math::test_double_api_div_0() { double_div( i64_to_double(1), double_add( - i64_to_double(-5), i64_to_double(5) + i64_to_double((uint64_t)-5), i64_to_double(5) )); eosio_assert(false, "should've thrown an error"); diff --git a/contracts/test_api/test_print.cpp b/contracts/test_api/test_print.cpp index fe2ba04771632f6421a63c948a7d64ef5a7ee3c0..a9287631df1381f305136afd796528811173a545 100644 --- a/contracts/test_api/test_print.cpp +++ b/contracts/test_api/test_print.cpp @@ -5,7 +5,8 @@ #include #include "test_api.hpp" -using namespace eosio; + +//using namespace eosio; void test_print::test_prints_l() { char ab[] = { 'a', 'b' }; @@ -17,22 +18,22 @@ void test_print::test_prints_l() { } void test_print::test_prints() { - prints("ab"); - prints(nullptr); - prints("c\0test_prints"); - prints(0); - prints("efg"); - prints(0); + prints("ab"); + prints(nullptr); + prints("c\0test_prints"); + prints(0); + prints("efg"); + prints(0); } void test_print::test_printi() { - printi(0); - printi(556644); - printi(-1); + printi(0); + printi(556644); + printi((uint64_t)-1); } void test_print::test_printi128() { - uint128_t a(-1); + uint128_t a((uint128_t)-1); uint128_t b(0); uint128_t c(87654323456); printi128(&a); @@ -41,14 +42,14 @@ void test_print::test_printi128() { } void test_print::test_printn() { - printn(N(abcde)); - printn(N(abBde)); - printn(N(1q1q1qAA)); - printn(N()); - printn(N(AAAAAA)); - printn(N(abcdefghijk)); - printn(N(abcdefghijkl)); - printn(N(abcdefghijkl1)); - printn(N(abcdefghijkl12)); - printn(N(abcdefghijkl123)); + printn(N(abcde)); + printn(N(abBde)); + printn(N(1q1q1qAA)); + printn(N()); + printn(N(AAAAAA)); + printn(N(abcdefghijk)); + printn(N(abcdefghijkl)); + printn(N(abcdefghijkl1)); + printn(N(abcdefghijkl12)); + printn(N(abcdefghijkl123)); } diff --git a/contracts/test_api/test_real.cpp b/contracts/test_api/test_real.cpp index a2a1bed4724d0ad64a256881a60b5ee9c65b19ae..fcb54698b025c175861502994e33df81e0119857 100644 --- a/contracts/test_api/test_real.cpp +++ b/contracts/test_api/test_real.cpp @@ -2,7 +2,9 @@ #include #include "test_api.hpp" + using namespace eosio; + void test_real::create_instances() { real lhs1(5); eosio_assert(lhs1.value() == 5, "real instance value is wrong"); @@ -21,6 +23,8 @@ void test_real::test_division_by_0() { real lhs1(5); real rhs1(0); real result1 = lhs1 / rhs1; + // in order to get rid of unused parameter warning + result1 = 0; eosio_assert(false, "should've thrown an error"); } diff --git a/contracts/test_api/test_transaction.cpp b/contracts/test_api/test_transaction.cpp index 6ec784d737c6655fb9838aebc781f8a49dddea87..bf08fff9bf839ecb4d96d64df0878f4586b56720 100644 --- a/contracts/test_api/test_transaction.cpp +++ b/contracts/test_api/test_transaction.cpp @@ -19,7 +19,7 @@ struct test_action_action { return action_name(NAME); } - vector data; + eosio::vector data; template friend DataStream& operator << ( DataStream& ds, const test_action_action& a ) { @@ -35,6 +35,7 @@ struct test_action_action { */ }; + template struct test_dummy_action { static account_name get_account() { @@ -49,38 +50,38 @@ struct test_dummy_action { int32_t c; template - friend DataStream& operator << ( DataStream& ds, const test_dummy_action& a ) { - ds << a.a; - ds << a.b; - ds << a.c; + friend DataStream& operator << ( DataStream& ds, const test_dummy_action& da ) { + ds << da.a; + ds << da.b; + ds << da.c; return ds; } template - friend DataStream& operator >> ( DataStream& ds, test_dummy_action& a ) { - ds >> a.a; - ds >> a.b; - ds >> a.c; + friend DataStream& operator >> ( DataStream& ds, test_dummy_action& da ) { + ds >> da.a; + ds >> da.b; + ds >> da.c; return ds; } }; #pragma pack(pop) -void copy_data(char* data, size_t data_len, vector& data_out) { - for (int i=0; i < data_len; i++) +void copy_data(char* data, size_t data_len, eosio::vector& data_out) { + for (unsigned int i=0; i < data_len; i++) data_out.push_back(data[i]); } void test_transaction::send_action() { test_dummy_action test_action = {DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C}; - action act(vector{{N(testapi), N(active)}}, test_action); + action act(eosio::vector{{N(testapi), N(active)}}, test_action); act.send(); } void test_transaction::send_action_empty() { test_action_action test_action; - action act(vector{{N(testapi), N(active)}}, test_action); + action act(eosio::vector{{N(testapi), N(active)}}, test_action); act.send(); } @@ -102,7 +103,7 @@ void test_transaction::send_action_large() { */ void test_transaction::send_action_recurse() { char buffer[1024]; - uint32_t size = read_action(buffer, 1024); + read_action(buffer, 1024); test_action_action test_action; copy_data(buffer, 1024, test_action.data); @@ -139,7 +140,7 @@ void test_transaction::test_read_transaction() { checksum256 h; transaction t; char* p = (char*)&t; - uint64_t read = read_transaction( (char*)&t, sizeof(t) ); + uint32_t read = read_transaction( (char*)&t, sizeof(t) ); sha256(p, read, &h); printhex( &h, sizeof(h) ); } diff --git a/contracts/test_api/test_types.cpp b/contracts/test_api/test_types.cpp index 56d57f10814424bcc25b4e889cf5d95e7a50b50d..53e1a07181b70dac258cf5ebef5ffe94b136b384 100644 --- a/contracts/test_api/test_types.cpp +++ b/contracts/test_api/test_types.cpp @@ -20,7 +20,7 @@ void test_types::types_size() { eosio_assert( sizeof(token_name) == 8, "token_name size != 8"); eosio_assert( sizeof(table_name) == 8, "table_name size != 8"); eosio_assert( sizeof(time) == 4, "time size != 4"); - eosio_assert( sizeof(key256) == 32, "key256 size != 32" ); + eosio_assert( sizeof(eosio::key256) == 32, "key256 size != 32" ); } void test_types::char_to_symbol() { @@ -59,7 +59,7 @@ void test_types::char_to_symbol() { for(unsigned char i = 0; i<255; i++) { if((i >= 'a' && i <= 'z') || (i >= '1' || i <= '5')) continue; - eosio_assert( eosio::char_to_symbol(i) == 0, "eosio::char_to_symbol() != 0"); + eosio_assert( eosio::char_to_symbol((char)i) == 0, "eosio::char_to_symbol() != 0"); } } diff --git a/contracts/test_api_db/test_db.cpp b/contracts/test_api_db/test_db.cpp index 4234500218b007a5ea6f75ec97aa58e9922f1654..62f72d64b598b0f9b00af7da3ff29042ce851af8 100644 --- a/contracts/test_api_db/test_db.cpp +++ b/contracts/test_api_db/test_db.cpp @@ -62,7 +62,7 @@ struct TestModel3xi64_V2 : TestModel3xi64 { extern "C" { void my_memset(void *vptr, unsigned char val, unsigned int size) { char *ptr = (char *)vptr; - while(size--) { *(ptr++)=val; } + while(size--) { *(ptr++)=(char)val; } } uint32_t my_strlen(const char *str) { uint32_t len = 0; @@ -187,7 +187,7 @@ void test_db::key_str_general() { const char* atr[] = { "atr", "atr", "atr", "atr" }; const char* ztr[] = { "ztr", "ztr", "ztr", "ztr" }; - uint32_t res=0; + int32_t res=0; //fill some data in contiguous tables for(int i=0; i < 4; ++i) { @@ -214,46 +214,46 @@ void test_db::key_str_general() { res = load_str(current_receiver(), current_receiver(), N(str), (char *)keys[0], STRLEN(keys[0]), tmp, 64); - eosio_assert(res == STRLEN(vals[0]) && my_memcmp((void *)vals[0], (void *)tmp, res), "load alice"); + eosio_assert(uint32_t(res) == STRLEN(vals[0]) && my_memcmp((void *)vals[0], (void *)tmp, uint32_t(res)), "load alice"); res = load_str(current_receiver(), current_receiver(), N(str), (char *)keys[1], STRLEN(keys[1]), tmp, 64); - eosio_assert(res == STRLEN(vals[1]) && my_memcmp((void *)vals[1], (void *)tmp, res), "load bob"); + eosio_assert(uint32_t(res) == STRLEN(vals[1]) && my_memcmp((void *)vals[1], (void *)tmp, uint32_t(res)), "load bob"); res = load_str(current_receiver(), current_receiver(), N(str), (char *)keys[2], STRLEN(keys[2]), tmp, 64); - eosio_assert(res == STRLEN(vals[2]) && my_memcmp((void *)vals[2], (void *)tmp, res), "load carol"); + eosio_assert(uint32_t(res) == STRLEN(vals[2]) && my_memcmp((void *)vals[2], (void *)tmp, uint32_t(res)), "load carol"); res = load_str(current_receiver(), current_receiver(), N(str), (char *)keys[3], STRLEN(keys[3]), tmp, 64); - eosio_assert(res == STRLEN(vals[3]) && my_memcmp((void *)vals[3], (void *)tmp, res), "load dave"); + eosio_assert(uint32_t(res) == STRLEN(vals[3]) && my_memcmp((void *)vals[3], (void *)tmp, uint32_t(res)), "load dave"); res = previous_str(current_receiver(), current_receiver(), N(str), (char *)keys[3], STRLEN(keys[3]), tmp, 64); - eosio_assert(res == STRLEN(vals[2]) && my_memcmp((void *)vals[2], (void *)tmp, res), "back carol"); + eosio_assert(uint32_t(res) == STRLEN(vals[2]) && my_memcmp((void *)vals[2], (void *)tmp, uint32_t(res)), "back carol"); res = previous_str(current_receiver(), current_receiver(), N(str), (char *)keys[2], STRLEN(keys[2]), tmp, 64); - eosio_assert(res == STRLEN(vals[1]) && my_memcmp((void *)vals[1], (void *)tmp, res), "back dave"); + eosio_assert(uint32_t(res) == STRLEN(vals[1]) && my_memcmp((void *)vals[1], (void *)tmp, uint32_t(res)), "back dave"); res = previous_str(current_receiver(), current_receiver(), N(str), (char *)keys[1], STRLEN(keys[1]), tmp, 64); - eosio_assert(res == STRLEN(vals[0]) && my_memcmp((void *)vals[0], (void *)tmp, res), "back alice"); + eosio_assert(uint32_t(res) == STRLEN(vals[0]) && my_memcmp((void *)vals[0], (void *)tmp, uint32_t(res)), "back alice"); res = previous_str(current_receiver(), current_receiver(), N(str), (char *)keys[0], STRLEN(keys[0]), tmp, 64); eosio_assert(res == 0, "no prev"); res = next_str(current_receiver(), current_receiver(), N(str), (char *)keys[0], STRLEN(keys[0]), tmp, 64); - eosio_assert(res == STRLEN(vals[1]) && my_memcmp((void *)vals[1], (void *)tmp, res), "next bob"); + eosio_assert(uint32_t(res) == STRLEN(vals[1]) && my_memcmp((void *)vals[1], (void *)tmp, uint32_t(res)), "next bob"); res = next_str(current_receiver(), current_receiver(), N(str), (char *)keys[1], STRLEN(keys[1]), tmp, 64); - eosio_assert(res == STRLEN(vals[2]) && my_memcmp((void *)vals[2], (void *)tmp, res), "next carol"); + eosio_assert(uint32_t(res) == STRLEN(vals[2]) && my_memcmp((void *)vals[2], (void *)tmp, uint32_t(res)), "next carol"); res = next_str(current_receiver(), current_receiver(), N(str), (char *)keys[2], STRLEN(keys[2]), tmp, 64); - eosio_assert(res == STRLEN(vals[3]) && my_memcmp((void *)vals[3], (void *)tmp, res), "next dave"); + eosio_assert(uint32_t(res) == STRLEN(vals[3]) && my_memcmp((void *)vals[3], (void *)tmp, uint32_t(res)), "next dave"); res = lower_bound_str(current_receiver(), current_receiver(), N(str), (char *)keys[0], STRLEN(keys[0]), tmp, 64); - eosio_assert(res == STRLEN(vals[0]) && my_memcmp((void *)vals[0], (void *)tmp, res), "lowerbound alice"); + eosio_assert(uint32_t(res) == STRLEN(vals[0]) && my_memcmp((void *)vals[0], (void *)tmp, uint32_t(res)), "lowerbound alice"); res = upper_bound_str(current_receiver(), current_receiver(), N(str), (char *)keys[0], STRLEN(keys[0]), tmp, 64); - eosio_assert(res == STRLEN(vals[1]) && my_memcmp((void *)vals[1], (void *)tmp, res), "upperbound bob"); + eosio_assert(uint32_t(res) == STRLEN(vals[1]) && my_memcmp((void *)vals[1], (void *)tmp, uint32_t(res)), "upperbound bob"); res = lower_bound_str(current_receiver(), current_receiver(), N(str), (char *)keys[3], STRLEN(keys[3]), tmp, 64); - eosio_assert(res == STRLEN(vals[3]) && my_memcmp((void *)vals[3], (void *)tmp, res), "upperbound dave"); + eosio_assert(uint32_t(res) == STRLEN(vals[3]) && my_memcmp((void *)vals[3], (void *)tmp, uint32_t(res)), "upperbound dave"); res = upper_bound_str(current_receiver(), current_receiver(), N(str), (char *)keys[3], STRLEN(keys[3]), tmp, 64); eosio_assert(res == 0, "no upper_bound"); @@ -262,7 +262,7 @@ void test_db::key_str_general() { eosio_assert(res != 0, "store dave" ); res = load_str(current_receiver(), current_receiver(), N(str), (char*)keys[3], STRLEN(keys[3]), tmp, 64 ); - eosio_assert(res == STRLEN(vals[2]) && my_memcmp((void*)vals[2], (void*)tmp, res), "load updated carol" ); + eosio_assert(uint32_t(res) == STRLEN(vals[2]) && my_memcmp((void*)vals[2], (void*)tmp, uint32_t(res)), "load updated carol" ); } #if 0 @@ -1564,12 +1564,12 @@ void test_db::primary_i64_general() { int itr = db_find_i64(current_receiver(), current_receiver(), table1, N(bob)); eosio_assert(itr >= 0, ""); - int buffer_len = 5; + uint32_t buffer_len = 5; char value[50]; auto len = db_get_i64(itr, value, buffer_len); value[buffer_len] = '\0'; std::string s(value); - eosio_assert(len == strlen("bob's info"), "primary_i64_general - db_get_i64"); + eosio_assert(uint32_t(len) == strlen("bob's info"), "primary_i64_general - db_get_i64"); eosio_assert(s == "bob's", "primary_i64_general - db_get_i64"); buffer_len = 20; @@ -1584,10 +1584,10 @@ void test_db::primary_i64_general() int itr = db_find_i64(current_receiver(), current_receiver(), table1, N(bob)); eosio_assert(itr >= 0, ""); const char* new_value = "bob's new info"; - int new_value_len = strlen(new_value); + uint32_t new_value_len = strlen(new_value); db_update_i64(itr, current_receiver(), new_value, new_value_len); char ret_value[50]; - auto len = db_get_i64(itr, ret_value, new_value_len); + db_get_i64(itr, ret_value, new_value_len); ret_value[new_value_len] = '\0'; std::string sret(ret_value); eosio_assert(sret == "bob's new info", "primary_i64_general - db_update_i64"); @@ -1674,7 +1674,7 @@ void test_db::idx64_general() {110, N(joe)} }; - for (int i = 0; i < sizeof(records)/sizeof(records[0]); ++i) { + for (uint32_t i = 0; i < sizeof(records)/sizeof(records[0]); ++i) { db_idx64_store(current_receiver(), table, current_receiver(), records[i].ssn, &records[i].name); } @@ -1818,7 +1818,7 @@ void test_db::idx64_upperbound() { secondary_type ub_sec = N(alice); uint64_t ub_prim = 0; - const uint64_t alice_ssn = 265, allyson_ssn = 650; + const uint64_t allyson_ssn = 650; int ub = db_idx64_upperbound(current_receiver(), current_receiver(), table, &ub_sec, &ub_prim); eosio_assert(ub_prim == allyson_ssn && ub_sec == N(allyson), ""); eosio_assert(ub == db_idx64_find_primary(current_receiver(), current_receiver(), table, &ub_sec, allyson_ssn), err.c_str()); @@ -1834,7 +1834,6 @@ void test_db::idx64_upperbound() { secondary_type ub_sec = N(joe); uint64_t ub_prim = 0; - const uint64_t ssn = 110; int ub = db_idx64_upperbound(current_receiver(), current_receiver(), table, &ub_sec, &ub_prim); eosio_assert(ub_prim == 0 && ub_sec == N(joe), err.c_str()); eosio_assert(ub < 0, err.c_str()); diff --git a/contracts/test_api_mem/test_api_mem.cpp b/contracts/test_api_mem/test_api_mem.cpp index 4d511ef68e8f9738295745738b65f062450af289..0d21950fa6b940532730bfcb7fe42e22ae16090a 100644 --- a/contracts/test_api_mem/test_api_mem.cpp +++ b/contracts/test_api_mem/test_api_mem.cpp @@ -14,7 +14,7 @@ extern "C" { } - void apply( unsigned long long code, unsigned long long action ) { + void apply( unsigned long long, unsigned long long action ) { //eosio::print("==> CONTRACT: ", code, " ", action, "\n"); diff --git a/contracts/test_api_mem/test_extended_memory.cpp b/contracts/test_api_mem/test_extended_memory.cpp index c3b0e54de07c338d3b98721e65066526365c8abe..9650218bdb0c6ee40a799b5509f168c270c70ca4 100644 --- a/contracts/test_api_mem/test_extended_memory.cpp +++ b/contracts/test_api_mem/test_extended_memory.cpp @@ -2,7 +2,7 @@ #include #include "../test_api/test_api.hpp" -using namespace eosio; +//using namespace eosio; void verify( const void* const ptr, const uint32_t val, const uint32_t size) { const char* char_ptr = (const char*)ptr; @@ -90,8 +90,8 @@ void test_extended_memory::test_page_memory_exceeded() { } void test_extended_memory::test_page_memory_negative_bytes() { - sbrk(-1); - eosio_assert(0, "Should have thrown exception for trying to remove memory"); + sbrk((uint32_t)-1); + eosio_assert(0, "Should have thrown exception for trying to remove memory"); } void test_extended_memory::test_initial_buffer() { diff --git a/contracts/test_api_mem/test_memory.cpp b/contracts/test_api_mem/test_memory.cpp index 694aa64c77ffce9c177e5ca275375d89d5d7ce30..e3c1a12f0062d74d75e1f8a612d5e932f97e21e6 100644 --- a/contracts/test_api_mem/test_memory.cpp +++ b/contracts/test_api_mem/test_memory.cpp @@ -2,10 +2,9 @@ * @file * @copyright defined in eos/LICENSE.txt */ -//#include + #include -using namespace eosio; void verify_mem(const void* const ptr, const uint32_t val, const uint32_t size) { diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d56b72cde2a062d0c57d322da09d772b17a2d14c --- /dev/null +++ b/debian/CMakeLists.txt @@ -0,0 +1 @@ +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/postinst" PARENT_SCOPE) diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000000000000000000000000000000000000..0e66c2a012874724368108d3dbb4f80f7e4c68bf --- /dev/null +++ b/debian/postinst @@ -0,0 +1,58 @@ +#!/bin/sh +# postinst script for eosio + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +set -e + +PACKAGE="eosio" +USER="eosio" +GROUP=${USER} + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +# source debconf library +. /usr/share/debconf/confmodule + +case "$1" in + + configure) + set +e + getent passwd ${USER} > /dev/null 2>&1 + if [ $? -ne 0 ]; then + adduser --no-create-home --group --system ${USER} + fi + set -e + chown ${USER}:${GROUP} /var/log/${PACKAGE} + chown ${USER}:${GROUP} /var/lib/${PACKAGE} + chown ${USER}:${GROUP} /etc/${PACKAGE} + chown ${USER}:${GROUP} /etc/${PACKAGE}/node_00 + chown ${USER} /usr/bin/eosiod + chmod u+s /usr/bin/eosiod + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +exit 0 diff --git a/eosio_build.sh b/eosio_build.sh index 784ac3f3b7de725c72cb12d245cb716de71ab54e..42c84dec8d0edcb32b47c6c5b715e621f5234e1c 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -68,6 +68,11 @@ C_COMPILER=gcc export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm ;; + "Linux Mint") + FILE=${WORK_DIR}/scripts/eosio_build_ubuntu.sh + CXX_COMPILER=clang++-4.0 + C_COMPILER=clang-4.0 + ;; "CentOS Linux") FILE=${WORK_DIR}/scripts/eosio_build_centos.sh export CMAKE=${HOME}/opt/cmake/bin/cmake @@ -143,4 +148,26 @@ exit -1 fi - printf "\n\t>>>>>>>>>>>>>>>>>>>> EOSIO has been successfully installed.\n\n" + printf "\n\t>>>>>>>>>>>>>>>>>>>> EOSIO has been successfully built.\n\n" + + if [ "x${EOSIO_BUILD_PACKAGE}" != "x" ]; then + # Build eos.io package + $CMAKE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \ + -DCMAKE_C_COMPILER=${C_COMPILER} -DWASM_ROOT=${WASM_ROOT} \ + -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DOPENSSL_LIBRARIES=${OPENSSL_LIBRARIES} \ + -DCMAKE_INSTALL_PREFIX=/usr .. + + if [ $? -ne 0 ]; then + printf "\n\t>>>>>>>>>>>>>>>>>>>> CMAKE building eos.io package has exited with the above error.\n\n" + exit -1 + fi + + make -j${CPU_CORE} VERBOSE=0 package + + if [ $? -ne 0 ]; then + printf "\n\t>>>>>>>>>>>>>>>>>>>> MAKE building eos.io package has exited with the above error.\n\n" + exit -1 + fi + + printf "\n\t>>>>>>>>>>>>>>>>>>>> eos.io package has been successfully built.\n\n" + fi diff --git a/libraries/abi_generator/CMakeLists.txt b/libraries/abi_generator/CMakeLists.txt index c316a964b2eb238c0a72bf674df5383fe3c9528f..88e32a84048252c87bb1fee4d83aaacaa05e240c 100644 --- a/libraries/abi_generator/CMakeLists.txt +++ b/libraries/abi_generator/CMakeLists.txt @@ -10,9 +10,9 @@ add_library( abi_generator abi_generator.cpp ${HEADERS} ) -target_include_directories( abi_generator - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" - "${LLVM_INCLUDE_DIRS}" ) +target_include_directories(abi_generator + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" + "${LLVM_INCLUDE_DIRS}") target_link_libraries(abi_generator eosio_chain clangRewrite diff --git a/libraries/appbase b/libraries/appbase index ef2b0c8d64f770d80ce537ec04d0de4bdc4d3585..31a02293a303782a97963a2e67815703f1123914 160000 --- a/libraries/appbase +++ b/libraries/appbase @@ -1 +1 @@ -Subproject commit ef2b0c8d64f770d80ce537ec04d0de4bdc4d3585 +Subproject commit 31a02293a303782a97963a2e67815703f1123914 diff --git a/libraries/chain/chain_controller.cpp b/libraries/chain/chain_controller.cpp index f754853eed093f2a5716efa736713ba64ed92f85..e88c127c0a70b893adcea1b7dd462157e7360584 100644 --- a/libraries/chain/chain_controller.cpp +++ b/libraries/chain/chain_controller.cpp @@ -43,7 +43,7 @@ bool chain_controller::is_start_of_round( block_num_type block_num )const { } uint32_t chain_controller::blocks_per_round()const { - return get_global_properties().active_producers.producers.size()*config::producer_repititions; + return get_global_properties().active_producers.producers.size()*config::producer_repetitions; } chain_controller::chain_controller( const chain_controller::controller_config& cfg ) @@ -1298,7 +1298,7 @@ void chain_controller::update_last_irreversible_block() // Write newly irreversible blocks to disk. First, get the number of the last block on disk... auto old_last_irreversible_block = _block_log.head(); - int last_block_on_disk = 0; + unsigned last_block_on_disk = 0; // If this is null, there are no blocks on disk, so the zero is correct if (old_last_irreversible_block) last_block_on_disk = old_last_irreversible_block->block_num(); @@ -1366,8 +1366,8 @@ account_name chain_controller::get_scheduled_producer(uint32_t slot_num)const uint64_t current_aslot = dpo.current_absolute_slot + slot_num; const auto& gpo = _db.get(); auto number_of_active_producers = gpo.active_producers.producers.size(); - auto index = current_aslot % (number_of_active_producers * config::producer_repititions); - index /= config::producer_repititions; + auto index = current_aslot % (number_of_active_producers * config::producer_repetitions); + index /= config::producer_repetitions; FC_ASSERT( gpo.active_producers.producers.size() > 0, "no producers defined" ); return gpo.active_producers.producers[index].producer_name; diff --git a/libraries/chain/include/eosio/chain/config.hpp b/libraries/chain/include/eosio/chain/config.hpp index 465dc60eb39d0eb1dedaa0ce3ac314cdc107b91f..80aaadd82fc40afcff413ffe7ab6663d21488790 100644 --- a/libraries/chain/include/eosio/chain/config.hpp +++ b/libraries/chain/include/eosio/chain/config.hpp @@ -6,6 +6,8 @@ #include #include +#pragma GCC diagnostic ignored "-Wunused-variable" + namespace eosio { namespace chain { namespace config { typedef __uint128_t uint128_t; @@ -65,13 +67,13 @@ const static uint16_t max_recursion_depth = 6; /** * The number of sequential blocks produced by a single producer */ -const static int producer_repititions = 12; +const static int producer_repetitions = 12; /** * The number of blocks produced per round is based upon all producers having a chance * to produce all of their consecutive blocks. */ -//const static int blocks_per_round = producer_count * producer_repititions; +//const static int blocks_per_round = producer_count * producer_repetitions; const static int irreversible_threshold_percent= 70 * percent_1; diff --git a/libraries/chain/include/eosio/chain/softfloat.hpp b/libraries/chain/include/eosio/chain/softfloat.hpp index c3354bc5f5dc69c990e5b5da4bfae6ec637e09d9..b3347187f7ecf9d710aff139054736997e4ce32a 100644 --- a/libraries/chain/include/eosio/chain/softfloat.hpp +++ b/libraries/chain/include/eosio/chain/softfloat.hpp @@ -12,38 +12,22 @@ extern "C" { float16_t ui32_to_f16( uint32_t ); float32_t ui32_to_f32( uint32_t ); float64_t ui32_to_f64( uint32_t ); -#ifdef SOFTFLOAT_FAST_INT64 -extFloat80_t ui32_to_extF80( uint32_t ); float128_t ui32_to_f128( uint32_t ); -#endif -void ui32_to_extF80M( uint32_t, extFloat80_t * ); void ui32_to_f128M( uint32_t, float128_t * ); float16_t ui64_to_f16( uint64_t ); float32_t ui64_to_f32( uint64_t ); float64_t ui64_to_f64( uint64_t ); -#ifdef SOFTFLOAT_FAST_INT64 -extFloat80_t ui64_to_extF80( uint64_t ); float128_t ui64_to_f128( uint64_t ); -#endif -void ui64_to_extF80M( uint64_t, extFloat80_t * ); void ui64_to_f128M( uint64_t, float128_t * ); float16_t i32_to_f16( int32_t ); float32_t i32_to_f32( int32_t ); float64_t i32_to_f64( int32_t ); -#ifdef SOFTFLOAT_FAST_INT64 -extFloat80_t i32_to_extF80( int32_t ); float128_t i32_to_f128( int32_t ); -#endif -void i32_to_extF80M( int32_t, extFloat80_t * ); void i32_to_f128M( int32_t, float128_t * ); float16_t i64_to_f16( int64_t ); float32_t i64_to_f32( int64_t ); float64_t i64_to_f64( int64_t ); -#ifdef SOFTFLOAT_FAST_INT64 -extFloat80_t i64_to_extF80( int64_t ); float128_t i64_to_f128( int64_t ); -#endif -void i64_to_extF80M( int64_t, extFloat80_t * ); void i64_to_f128M( int64_t, float128_t * ); /*---------------------------------------------------------------------------- @@ -59,11 +43,7 @@ int_fast32_t f16_to_i32_r_minMag( float16_t, bool ); int_fast64_t f16_to_i64_r_minMag( float16_t, bool ); float32_t f16_to_f32( float16_t ); float64_t f16_to_f64( float16_t ); -#ifdef SOFTFLOAT_FAST_INT64 -extFloat80_t f16_to_extF80( float16_t ); float128_t f16_to_f128( float16_t ); -#endif -void f16_to_extF80M( float16_t, extFloat80_t * ); void f16_to_f128M( float16_t, float128_t * ); float16_t f16_roundToInt( float16_t, uint_fast8_t, bool ); float16_t f16_add( float16_t, float16_t ); @@ -94,11 +74,8 @@ int_fast32_t f32_to_i32_r_minMag( float32_t, bool ); int_fast64_t f32_to_i64_r_minMag( float32_t, bool ); float16_t f32_to_f16( float32_t ); float64_t f32_to_f64( float32_t ); -#ifdef SOFTFLOAT_FAST_INT64 -extFloat80_t f32_to_extF80( float32_t ); float128_t f32_to_f128( float32_t ); -#endif -void f32_to_extF80M( float32_t, extFloat80_t * ); + void f32_to_f128M( float32_t, float128_t * ); float32_t f32_roundToInt( float32_t, uint_fast8_t, bool ); float32_t f32_add( float32_t, float32_t ); @@ -129,11 +106,7 @@ int_fast32_t f64_to_i32_r_minMag( float64_t, bool ); int_fast64_t f64_to_i64_r_minMag( float64_t, bool ); float16_t f64_to_f16( float64_t ); float32_t f64_to_f32( float64_t ); -#ifdef SOFTFLOAT_FAST_INT64 -extFloat80_t f64_to_extF80( float64_t ); float128_t f64_to_f128( float64_t ); -#endif -void f64_to_extF80M( float64_t, extFloat80_t * ); void f64_to_f128M( float64_t, float128_t * ); float64_t f64_roundToInt( float64_t, uint_fast8_t, bool ); float64_t f64_add( float64_t, float64_t ); @@ -151,76 +124,9 @@ bool f64_le_quiet( float64_t, float64_t ); bool f64_lt_quiet( float64_t, float64_t ); bool f64_isSignalingNaN( float64_t ); -/*---------------------------------------------------------------------------- -| Rounding precision for 80-bit extended double-precision floating-point. -| Valid values are 32, 64, and 80. -*----------------------------------------------------------------------------*/ -extern THREAD_LOCAL uint_fast8_t extF80_roundingPrecision; - -/*---------------------------------------------------------------------------- -| 80-bit extended double-precision floating-point operations. -*----------------------------------------------------------------------------*/ -#ifdef SOFTFLOAT_FAST_INT64 -uint_fast32_t extF80_to_ui32( extFloat80_t, uint_fast8_t, bool ); -uint_fast64_t extF80_to_ui64( extFloat80_t, uint_fast8_t, bool ); -int_fast32_t extF80_to_i32( extFloat80_t, uint_fast8_t, bool ); -int_fast64_t extF80_to_i64( extFloat80_t, uint_fast8_t, bool ); -uint_fast32_t extF80_to_ui32_r_minMag( extFloat80_t, bool ); -uint_fast64_t extF80_to_ui64_r_minMag( extFloat80_t, bool ); -int_fast32_t extF80_to_i32_r_minMag( extFloat80_t, bool ); -int_fast64_t extF80_to_i64_r_minMag( extFloat80_t, bool ); -float16_t extF80_to_f16( extFloat80_t ); -float32_t extF80_to_f32( extFloat80_t ); -float64_t extF80_to_f64( extFloat80_t ); -float128_t extF80_to_f128( extFloat80_t ); -extFloat80_t extF80_roundToInt( extFloat80_t, uint_fast8_t, bool ); -extFloat80_t extF80_add( extFloat80_t, extFloat80_t ); -extFloat80_t extF80_sub( extFloat80_t, extFloat80_t ); -extFloat80_t extF80_mul( extFloat80_t, extFloat80_t ); -extFloat80_t extF80_div( extFloat80_t, extFloat80_t ); -extFloat80_t extF80_rem( extFloat80_t, extFloat80_t ); -extFloat80_t extF80_sqrt( extFloat80_t ); -bool extF80_eq( extFloat80_t, extFloat80_t ); -bool extF80_le( extFloat80_t, extFloat80_t ); -bool extF80_lt( extFloat80_t, extFloat80_t ); -bool extF80_eq_signaling( extFloat80_t, extFloat80_t ); -bool extF80_le_quiet( extFloat80_t, extFloat80_t ); -bool extF80_lt_quiet( extFloat80_t, extFloat80_t ); -bool extF80_isSignalingNaN( extFloat80_t ); -#endif -uint_fast32_t extF80M_to_ui32( const extFloat80_t *, uint_fast8_t, bool ); -uint_fast64_t extF80M_to_ui64( const extFloat80_t *, uint_fast8_t, bool ); -int_fast32_t extF80M_to_i32( const extFloat80_t *, uint_fast8_t, bool ); -int_fast64_t extF80M_to_i64( const extFloat80_t *, uint_fast8_t, bool ); -uint_fast32_t extF80M_to_ui32_r_minMag( const extFloat80_t *, bool ); -uint_fast64_t extF80M_to_ui64_r_minMag( const extFloat80_t *, bool ); -int_fast32_t extF80M_to_i32_r_minMag( const extFloat80_t *, bool ); -int_fast64_t extF80M_to_i64_r_minMag( const extFloat80_t *, bool ); -float16_t extF80M_to_f16( const extFloat80_t * ); -float32_t extF80M_to_f32( const extFloat80_t * ); -float64_t extF80M_to_f64( const extFloat80_t * ); -void extF80M_to_f128M( const extFloat80_t *, float128_t * ); -void - extF80M_roundToInt( - const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ); -void extF80M_add( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); -void extF80M_sub( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); -void extF80M_mul( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); -void extF80M_div( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); -void extF80M_rem( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); -void extF80M_sqrt( const extFloat80_t *, extFloat80_t * ); -bool extF80M_eq( const extFloat80_t *, const extFloat80_t * ); -bool extF80M_le( const extFloat80_t *, const extFloat80_t * ); -bool extF80M_lt( const extFloat80_t *, const extFloat80_t * ); -bool extF80M_eq_signaling( const extFloat80_t *, const extFloat80_t * ); -bool extF80M_le_quiet( const extFloat80_t *, const extFloat80_t * ); -bool extF80M_lt_quiet( const extFloat80_t *, const extFloat80_t * ); -bool extF80M_isSignalingNaN( const extFloat80_t * ); - /*---------------------------------------------------------------------------- | 128-bit (quadruple-precision) floating-point operations. *----------------------------------------------------------------------------*/ -#ifdef SOFTFLOAT_FAST_INT64 uint_fast32_t f128_to_ui32( float128_t, uint_fast8_t, bool ); uint_fast64_t f128_to_ui64( float128_t, uint_fast8_t, bool ); int_fast32_t f128_to_i32( float128_t, uint_fast8_t, bool ); @@ -232,7 +138,6 @@ int_fast64_t f128_to_i64_r_minMag( float128_t, bool ); float16_t f128_to_f16( float128_t ); float32_t f128_to_f32( float128_t ); float64_t f128_to_f64( float128_t ); -extFloat80_t f128_to_extF80( float128_t ); float128_t f128_roundToInt( float128_t, uint_fast8_t, bool ); float128_t f128_add( float128_t, float128_t ); float128_t f128_sub( float128_t, float128_t ); @@ -248,7 +153,7 @@ bool f128_eq_signaling( float128_t, float128_t ); bool f128_le_quiet( float128_t, float128_t ); bool f128_lt_quiet( float128_t, float128_t ); bool f128_isSignalingNaN( float128_t ); -#endif + uint_fast32_t f128M_to_ui32( const float128_t *, uint_fast8_t, bool ); uint_fast64_t f128M_to_ui64( const float128_t *, uint_fast8_t, bool ); int_fast32_t f128M_to_i32( const float128_t *, uint_fast8_t, bool ); @@ -260,7 +165,6 @@ int_fast64_t f128M_to_i64_r_minMag( const float128_t *, bool ); float16_t f128M_to_f16( const float128_t * ); float32_t f128M_to_f32( const float128_t * ); float64_t f128M_to_f64( const float128_t * ); -void f128M_to_extF80M( const float128_t *, extFloat80_t * ); void f128M_roundToInt( const float128_t *, uint_fast8_t, bool, float128_t * ); void f128M_add( const float128_t *, const float128_t *, float128_t * ); void f128M_sub( const float128_t *, const float128_t *, float128_t * ); diff --git a/libraries/chain/wasm_interface.cpp b/libraries/chain/wasm_interface.cpp index a11806e8b88f8133b66876c907abde8b2fe2c691..af84c7e0e7a6f13c7f54e2629e60ffbd0b935772 100644 --- a/libraries/chain/wasm_interface.cpp +++ b/libraries/chain/wasm_interface.cpp @@ -360,8 +360,8 @@ class context_aware_api { } protected: - apply_context& context; wasm_cache::entry& code; + apply_context& context; wasm_interface::vm_type vm; }; @@ -408,8 +408,8 @@ class privileged_api : public context_aware_api { } void set_resource_limits( account_name account, - int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight, - int64_t cpu_usec_per_period ) { + uint64_t ram_bytes, int64_t net_weight, int64_t cpu_weight, + int64_t /*cpu_usec_per_period*/ ) { auto& buo = context.db.get( account ); FC_ASSERT( buo.db_usage <= ram_bytes, "attempt to free too much space" ); @@ -1208,6 +1208,105 @@ class compiler_builtins : public context_aware_api { lhs %= rhs; ret = lhs; } + + void __addtf3( float128_t& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ lb, hb }}; + ret = f128_add( a, b ); + } + void __subtf3( float128_t& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ lb, hb }}; + ret = f128_sub( a, b ); + } + void __multf3( float128_t& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ lb, hb }}; + ret = f128_mul( a, b ); + } + void __divtf3( float128_t& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ lb, hb }}; + ret = f128_div( a, b ); + } + int __eqtf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ la, ha }}; + return f128_eq( a, b ); + } + int __netf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ la, ha }}; + return !f128_eq( a, b ); + } + int __getf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ la, ha }}; + return !f128_lt( a, b ); + } + int __gttf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ la, ha }}; + return !f128_lt( a, b ) && !f128_eq( a, b ); + } + int __letf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ la, ha }}; + return f128_le( a, b ); + } + int __lttf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ la, ha }}; + return f128_lt( a, b ); + } + int __cmptf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ la, ha }}; + if ( f128_lt( a, b ) ) + return -1; + if ( f128_eq( a, b ) ) + return 0; + return 1; + } + int __unordtf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb ) { + float128_t a = {{ la, ha }}; + float128_t b = {{ la, ha }}; + if ( f128_isSignalingNaN( a ) || f128_isSignalingNaN( b ) ) + return 1; + return 0; + } + void __extendsftf2( float128_t& ret, uint32_t f ) { + float32_t in = { f }; + ret = f32_to_f128( in ); + } + void __extenddftf2( float128_t& ret, uint64_t f ) { + float64_t in = { f }; + ret = f64_to_f128( in ); + } + int64_t __fixtfdi( uint64_t l, uint64_t h ) { + float128_t f = {{ l, h }}; + return f128_to_i64( f, 0, false ); + } + int32_t __fixtfsi( uint64_t l, uint64_t h ) { + float128_t f = {{ l, h }}; + return f128_to_i32( f, 0, false ); + } + uint64_t __fixunstfdi( uint64_t l, uint64_t h ) { + float128_t f = {{ l, h }}; + return f128_to_ui64( f, 0, false ); + } + uint32_t __fixunstfsi( uint64_t l, uint64_t h ) { + float128_t f = {{ l, h }}; + return f128_to_ui32( f, 0, false ); + } + uint64_t __trunctfdf2( uint64_t l, uint64_t h ) { + float128_t f = {{ l, h }}; + return f128_to_f64( f ).v; + } + uint32_t __trunctfsf2( uint64_t l, uint64_t h ) { + float128_t f = {{ l, h }}; + return f128_to_f32( f ).v; + } static constexpr uint32_t SHIFT_WIDTH = (sizeof(uint64_t)*8)-1; }; @@ -1308,6 +1407,25 @@ REGISTER_INTRINSICS(compiler_builtins, (__modti3, void(int, int64_t, int64_t, int64_t, int64_t) ) (__umodti3, void(int, int64_t, int64_t, int64_t, int64_t) ) (__multi3, void(int, int64_t, int64_t, int64_t, int64_t) ) + (__addtf3, void(int, int64_t, int64_t, int64_t, int64_t) ) + (__subtf3, void(int, int64_t, int64_t, int64_t, int64_t) ) + (__multf3, void(int, int64_t, int64_t, int64_t, int64_t) ) + (__divtf3, void(int, int64_t, int64_t, int64_t, int64_t) ) + (__eqtf2, int(int64_t, int64_t, int64_t, int64_t) ) + (__netf2, int(int64_t, int64_t, int64_t, int64_t) ) + (__getf2, int(int64_t, int64_t, int64_t, int64_t) ) + (__gttf2, int(int64_t, int64_t, int64_t, int64_t) ) + (__lttf2, int(int64_t, int64_t, int64_t, int64_t) ) + (__cmptf2, int(int64_t, int64_t, int64_t, int64_t) ) + (__unordtf2, int(int64_t, int64_t, int64_t, int64_t) ) + (__extendsftf2, void(int, int) ) + (__extenddftf2, void(int, int64_t) ) + (__fixtfdi, int64_t(int64_t, int64_t) ) + (__fixtfsi, int(int64_t, int64_t) ) + (__fixunstfdi, int64_t(int64_t, int64_t) ) + (__fixunstfsi, int(int64_t, int64_t) ) + (__trunctfdf2, int64_t(int64_t, int64_t) ) + (__trunctfsf2, int(int64_t, int64_t) ) ); REGISTER_INTRINSICS(privileged_api, diff --git a/libraries/chainbase b/libraries/chainbase index 664fdd9e79263a894794f96959612ec2d1d013d0..4ebab558f506f13457317fe9f0ca5b79511b76a1 160000 --- a/libraries/chainbase +++ b/libraries/chainbase @@ -1 +1 @@ -Subproject commit 664fdd9e79263a894794f96959612ec2d1d013d0 +Subproject commit 4ebab558f506f13457317fe9f0ca5b79511b76a1 diff --git a/libraries/fc/CMakeLists.txt b/libraries/fc/CMakeLists.txt index bcdc99f4c569e90598cec25404864f7d18b6789f..cc96b3807d43e2cc3382615afecac898c49d6160 100644 --- a/libraries/fc/CMakeLists.txt +++ b/libraries/fc/CMakeLists.txt @@ -2,9 +2,9 @@ #INCLUDE(GetPrerequisites) #INCLUDE(VersionMacros) -SET( DEFAULT_HEADER_INSTALL_DIR include/${target} ) -SET( DEFAULT_LIBRARY_INSTALL_DIR lib/ ) -SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ ) +SET( DEFAULT_HEADER_INSTALL_DIR usr/include/${target} ) +SET( DEFAULT_LIBRARY_INSTALL_DIR usr/lib ) +SET( DEFAULT_EXECUTABLE_INSTALL_DIR usr/bin ) SET( CMAKE_DEBUG_POSTFIX _debug ) SET( BUILD_SHARED_LIBS NO ) SET( ECC_IMPL secp256k1 CACHE STRING "secp256k1 or openssl or mixed" ) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 061118374e31eebb4158d4200c9430a3d33dbf78..47c9f8a1ce48a112f975c0c41e6b02dc8189605d 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -11,3 +11,6 @@ add_subdirectory(wallet_api_plugin) add_subdirectory(txn_test_gen_plugin) add_subdirectory(faucet_testnet_plugin) add_subdirectory(mongo_db_plugin) + +# Forward variables to top level so packaging picks them up +set(CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS} PARENT_SCOPE) diff --git a/plugins/account_history_api_plugin/CMakeLists.txt b/plugins/account_history_api_plugin/CMakeLists.txt index 453798434e7fee01d0b089739c8355e6fe31fdcd..544b7d56609ea77ed5d2bcb7a9bafb2c8e211932 100644 --- a/plugins/account_history_api_plugin/CMakeLists.txt +++ b/plugins/account_history_api_plugin/CMakeLists.txt @@ -1,4 +1,4 @@ -file(GLOB HEADERS "include/eosio/account_history_api_plugin/*.hpp") +file( GLOB HEADERS "include/eosio/account_history_api_plugin/*.hpp" ) add_library( account_history_api_plugin account_history_api_plugin.cpp ${HEADERS} ) diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index d4d3a1702fb68515fee049c28caa244b4b114c87..bc3941f3259b688e650549d19033580ef58cea0f 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -60,7 +60,7 @@ chain_plugin::~chain_plugin(){} void chain_plugin::set_program_options(options_description& cli, options_description& cfg) { cfg.add_options() - ("genesis-json", bpo::value(), "File to read Genesis State from") + ("genesis-json", bpo::value()->default_value("genesis.json"), "File to read Genesis State from") ("genesis-timestamp", bpo::value(), "override the initial timestamp in the Genesis State file") ("block-log-dir", bpo::value()->default_value("blocks"), "the location of the block log (absolute path or relative to application data dir)") @@ -93,7 +93,11 @@ void chain_plugin::plugin_initialize(const variables_map& options) { ilog("initializing chain plugin"); if(options.count("genesis-json")) { - my->genesis_file = options.at("genesis-json").as(); + auto genesis = options.at("genesis-json").as(); + if(genesis.is_relative()) + my->genesis_file = app().config_dir() / genesis; + else + my->genesis_file = genesis; } if(options.count("genesis-timestamp")) { string tstr = options.at("genesis-timestamp").as(); diff --git a/plugins/mongo_db_plugin/CMakeLists.txt b/plugins/mongo_db_plugin/CMakeLists.txt index 8bff5f7827f538768d7eb55aa3ed218db2e6297f..b9eabd91eade8920b9570c9ad504f8388ab1c5a9 100644 --- a/plugins/mongo_db_plugin/CMakeLists.txt +++ b/plugins/mongo_db_plugin/CMakeLists.txt @@ -79,6 +79,8 @@ if(BUILD_MONGO_DB_PLUGIN) PUBLIC chain_plugin eosio_chain appbase ${EOS_LIBMONGOCXX} ${EOS_LIBBSONCXX} ) + + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmongoc-1.0-0 (>= 1.3)" PARENT_SCOPE) else() message("mongo_db_plugin not selected and will be omitted.") endif() diff --git a/plugins/net_plugin/CMakeLists.txt b/plugins/net_plugin/CMakeLists.txt index ae81a2ab5f4027547e9412846007a9a2a33692f4..5485d834470d54dffaec783da7822d7cc2bc7cad 100644 --- a/plugins/net_plugin/CMakeLists.txt +++ b/plugins/net_plugin/CMakeLists.txt @@ -4,4 +4,4 @@ add_library( net_plugin ${HEADERS} ) target_link_libraries( net_plugin chain_plugin producer_plugin appbase fc ) -target_include_directories( net_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) +target_include_directories( net_plugin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ) diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 5844e5df25c6f0523948fe7763b2e588673269c0..629ed4c31fb24752a7a1ffb8de780308f7fa54dd 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -379,7 +379,7 @@ namespace eosio { time_point start_time; ///< time request made or received }; - struct handshake_initializer { + struct handshake_initializer { static void populate(handshake_message &hello); }; diff --git a/plugins/template_plugin/template_plugin.cpp b/plugins/template_plugin/template_plugin.cpp index 57d40c33ef4689b5fcf30e429dd3870fa46211bc..897d16183a2068095bcd7dc4613d4147095f4871 100644 --- a/plugins/template_plugin/template_plugin.cpp +++ b/plugins/template_plugin/template_plugin.cpp @@ -5,6 +5,7 @@ #include namespace eosio { + static appbase::abstract_plugin& _template_plugin = app().register_plugin(); class template_plugin_impl { public: diff --git a/plugins/txn_test_gen_plugin/CMakeLists.txt b/plugins/txn_test_gen_plugin/CMakeLists.txt index 5ca2fd82d9fe0ef82ba030bbb5005d3a6ec960eb..692e5bce96620830e59d29617a8a7b15d49295a4 100644 --- a/plugins/txn_test_gen_plugin/CMakeLists.txt +++ b/plugins/txn_test_gen_plugin/CMakeLists.txt @@ -6,3 +6,5 @@ add_library( txn_test_gen_plugin target_link_libraries( txn_test_gen_plugin appbase fc http_plugin chain_plugin ) target_include_directories( txn_test_gen_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) target_include_directories( txn_test_gen_plugin PUBLIC ${CMAKE_BINARY_DIR}/contracts ) + +add_dependencies( txn_test_gen_plugin currency ) diff --git a/plugins/wallet_plugin/wallet_plugin.cpp b/plugins/wallet_plugin/wallet_plugin.cpp index 24e4bfc4d64208c160324272d3d7d2fa8601ddb1..bf663d0cc0b16a0c3ffdd9afd5059bc4c794bf17 100644 --- a/plugins/wallet_plugin/wallet_plugin.cpp +++ b/plugins/wallet_plugin/wallet_plugin.cpp @@ -12,6 +12,8 @@ namespace fc { class variant; } namespace eosio { +static appbase::abstract_plugin& _wallet_plugin = app().register_plugin(); + wallet_plugin::wallet_plugin() : wallet_manager_ptr(new wallet_manager()) { } diff --git a/programs/debug_node/CMakeLists.txt b/programs/debug_node/CMakeLists.txt index 9bb043e14ee65b1c1883bf59f1da3a3888384f36..f335d7e810c9342b994edbda195113b73e4ce100 100644 --- a/programs/debug_node/CMakeLists.txt +++ b/programs/debug_node/CMakeLists.txt @@ -15,7 +15,7 @@ target_link_libraries( debug_node install( TARGETS debug_node - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION usr/bin + LIBRARY DESTINATION usr/lib + ARCHIVE DESTINATION usr/lib ) diff --git a/programs/eosio-abigen/CMakeLists.txt b/programs/eosio-abigen/CMakeLists.txt index 61ac022a2e67a76746681899b31f7af46d511f8e..93df3c89ef4d04d8141b23111d2e3d2e5f50d355 100644 --- a/programs/eosio-abigen/CMakeLists.txt +++ b/programs/eosio-abigen/CMakeLists.txt @@ -22,7 +22,7 @@ target_link_libraries(eosio-abigen abi_generator) install( TARGETS eosio-abigen - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} ) diff --git a/programs/eosio-applesedemo/CMakeLists.txt b/programs/eosio-applesedemo/CMakeLists.txt index 145c5a1081c22ab5b454ea2ab2db689a6b734591..61c23274cf1c95a995057fb85fa09dd0a6f0de5c 100644 --- a/programs/eosio-applesedemo/CMakeLists.txt +++ b/programs/eosio-applesedemo/CMakeLists.txt @@ -20,9 +20,9 @@ add_custom_command(TARGET eosio-applesedemo POST_BUILD install( TARGETS eosio-applesedemo - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} ) endif(APPLE) diff --git a/programs/eosio-launcher/CMakeLists.txt b/programs/eosio-launcher/CMakeLists.txt index 84cff6df0379b938e8aba20498840e63ebf1980b..c23243239a53ddf697a4667cb819b4a246a92409 100644 --- a/programs/eosio-launcher/CMakeLists.txt +++ b/programs/eosio-launcher/CMakeLists.txt @@ -34,7 +34,7 @@ target_link_libraries(eosio-launcher install( TARGETS eosio-launcher - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} ) diff --git a/programs/eosio-launcher/main.cpp b/programs/eosio-launcher/main.cpp index b7d1531b29a4bbf4f9f3a5874708f9748918ad59..a4eb8583325b952e188e4ce25aaea68baebe8dba 100644 --- a/programs/eosio-launcher/main.cpp +++ b/programs/eosio-launcher/main.cpp @@ -12,7 +12,10 @@ #include #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" #include +#pragma GCC diagnostic pop #include #include #include @@ -366,6 +369,7 @@ struct launcher_def { const bf::path &destination); void write_config_file (tn_node_def &node); void write_logging_config_file (tn_node_def &node); + void write_genesis_file (tn_node_def &node); void make_ring (); void make_star (); void make_mesh (); @@ -557,6 +561,7 @@ launcher_def::generate () { for (auto &node : network.nodes) { write_config_file(node.second); write_logging_config_file(node.second); + write_genesis_file(node.second); } } write_dot_file (); @@ -758,6 +763,7 @@ launcher_def::deploy_config_files (tn_node_def &node) { bf::path source = stage / instance.data_dir / "config.ini"; bf::path logging_source = stage / instance.data_dir / "logging.json"; + bf::path genesis_source = stage / instance.data_dir / "genesis.json"; if (host->is_local()) { bf::path dd = bf::path(host->eos_root_dir) / instance.data_dir; if (bf::exists (dd)) { @@ -784,6 +790,7 @@ launcher_def::deploy_config_files (tn_node_def &node) { << " errno " << ec.value() << " " << strerror(ec.value()) << endl; exit (-1); } + bf::copy_file (genesis_source, dd / "genesis.json", bf::copy_option::overwrite_if_exists); bf::copy_file (logging_source, dd / "logging.json", bf::copy_option::overwrite_if_exists); bf::copy_file (source, dd / "config.ini", bf::copy_option::overwrite_if_exists); } @@ -810,6 +817,16 @@ launcher_def::deploy_config_files (tn_node_def &node) { cerr << "unable to scp logging config file to host " << host->host_name << endl; exit(-1); } + + dpath = bf::path (host->eos_root_dir) / instance.data_dir / "genesis.json"; + + scp_cmd_line = compose_scp_command(*host, genesis_source, dpath); + + res = boost::process::system (scp_cmd_line); + if (res != 0) { + cerr << "unable to scp genesis.json file to host " << host->host_name << endl; + exit(-1); + } } return host; } @@ -904,7 +921,7 @@ launcher_def::write_logging_config_file(tn_node_def &node) { bf::path filename; eosd_def &instance = *node.instance; - bf::path dd = stage/ instance.data_dir; + bf::path dd = stage / instance.data_dir; if (!bf::exists(dd)) { bf::create_directory(dd); } @@ -933,6 +950,22 @@ launcher_def::write_logging_config_file(tn_node_def &node) { cfg.close(); } +void +launcher_def::write_genesis_file(tn_node_def &node) { + bf::path filename; + eosd_def &instance = *node.instance; + + bf::path dd = stage / instance.data_dir; + if (!bf::exists(dd)) { + bf::create_directory(dd); + } + + filename = dd / "genesis.json"; + + bf::path genesis_source = bf::current_path() / "etc"/ "eosio" / "node_00" / "genesis.json"; + bf::copy_file(genesis_source, filename, bf::copy_option::overwrite_if_exists); +} + void launcher_def::make_ring () { bind_nodes(); @@ -1127,6 +1160,7 @@ launcher_def::launch (eosd_def &instance, string >s) { } eosdcmd += "--data-dir " + instance.data_dir; + eosdcmd += " --config-dir " + instance.data_dir; if (gts.length()) { eosdcmd += " --genesis-timestamp " + gts; } diff --git a/programs/eosioc/CMakeLists.txt b/programs/eosioc/CMakeLists.txt index d6c8a479d8ee80f09c437c220e7f0104654d7122..19e30cd5a0c4b2fdf90d8054aada9078dfe11955 100644 --- a/programs/eosioc/CMakeLists.txt +++ b/programs/eosioc/CMakeLists.txt @@ -38,7 +38,7 @@ target_link_libraries( eosioc install( TARGETS eosioc - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} ) diff --git a/programs/eosioc/main.cpp b/programs/eosioc/main.cpp index 1328e2dc186954eebf3b6fd520ae1663843cf6b6..1d94fb3881e7af43e20885eeb71273765e128cb0 100644 --- a/programs/eosioc/main.cpp +++ b/programs/eosioc/main.cpp @@ -639,7 +639,7 @@ int main( int argc, char** argv ) { fc::read_file_contents(wastPath, wast); vector wasm; - const string binary_wasm_header = "\x00\x61\x73\x6d"; + const string binary_wasm_header("\x00\x61\x73\x6d", 4); if(wast.compare(0, 4, binary_wasm_header) == 0) { std::cout << localized("Using already assembled WASM...") << std::endl; wasm = vector(wast.begin(), wast.end()); diff --git a/programs/eosiod/CMakeLists.txt b/programs/eosiod/CMakeLists.txt index d29ebd692f3e299f05468dddde04616a58b352a8..9a7c78ff18a3ac1bef4505675161f050315d6eed 100644 --- a/programs/eosiod/CMakeLists.txt +++ b/programs/eosiod/CMakeLists.txt @@ -58,7 +58,27 @@ endif() install( TARGETS eosiod - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} +) +install(DIRECTORY DESTINATION ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/eosio + DIRECTORY_PERMISSIONS OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + GROUP_WRITE + GROUP_EXECUTE + WORLD_READ + WORLD_EXECUTE +) +install(DIRECTORY DESTINATION ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/eosio + DIRECTORY_PERMISSIONS OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + GROUP_WRITE + GROUP_EXECUTE + WORLD_READ + WORLD_EXECUTE ) diff --git a/programs/eosiod/main.cpp b/programs/eosiod/main.cpp index 2995d8316157c0b0def98e3554f50659ae6301aa..fb2666fca8951d250a4037a7a94eb9bd69fca81b 100644 --- a/programs/eosiod/main.cpp +++ b/programs/eosiod/main.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include "config.hpp" @@ -27,62 +28,87 @@ namespace detail { void configure_logging(const bfs::path& config_path) { - try { - try { - fc::configure_logging(config_path); - } catch (...) { - elog("Error reloading logging.json"); - throw; - } - } catch (const fc::exception& e) { - elog("${e}", ("e",e.to_detail_string())); - } catch (const boost::exception& e) { - elog("${e}", ("e",boost::diagnostic_information(e))); - } catch (const std::exception& e) { - elog("${e}", ("e",e.what())); - } catch (...) { - // empty - } + try { + try { + fc::configure_logging(config_path); + } catch (...) { + elog("Error reloading logging.json"); + throw; + } + } catch (const fc::exception& e) { + elog("${e}", ("e",e.to_detail_string())); + } catch (const boost::exception& e) { + elog("${e}", ("e",boost::diagnostic_information(e))); + } catch (const std::exception& e) { + elog("${e}", ("e",e.what())); + } catch (...) { + // empty + } } } // namespace detail void logging_conf_loop() { - std::shared_ptr sighup_set(new boost::asio::signal_set(app().get_io_service(), SIGHUP)); - sighup_set->async_wait([sighup_set](const boost::system::error_code& err, int /*num*/) { - if(!err) - { - ilog("Received HUP. Reloading logging configuration."); - auto config_path = app().get_logging_conf(); - if(fc::exists(config_path)) - ::detail::configure_logging(config_path); - for(auto iter : fc::get_appender_map()) - iter.second->initialize(app().get_io_service()); - logging_conf_loop(); - } - }); + std::shared_ptr sighup_set(new boost::asio::signal_set(app().get_io_service(), SIGHUP)); + sighup_set->async_wait([sighup_set](const boost::system::error_code& err, int /*num*/) { + if(!err) + { + ilog("Received HUP. Reloading logging configuration."); + auto config_path = app().get_logging_conf(); + if(fc::exists(config_path)) + ::detail::configure_logging(config_path); + for(auto iter : fc::get_appender_map()) + iter.second->initialize(app().get_io_service()); + logging_conf_loop(); + } + }); } void initialize_logging() { - auto config_path = app().get_logging_conf(); - if(fc::exists(config_path)) - fc::configure_logging(config_path); // intentionally allowing exceptions to escape - for(auto iter : fc::get_appender_map()) - iter.second->initialize(app().get_io_service()); + auto config_path = app().get_logging_conf(); + if(fc::exists(config_path)) + fc::configure_logging(config_path); // intentionally allowing exceptions to escape + for(auto iter : fc::get_appender_map()) + iter.second->initialize(app().get_io_service()); + + logging_conf_loop(); +} - logging_conf_loop(); +bfs::path determine_root_directory() +{ + bfs::path root; + char* path = std::getenv("EOSIO_ROOT"); + if(path != nullptr) + root = bfs::path(path); + else { + bfs::path p = boost::dll::program_location(); + while(p != p.root_directory()) { + p = p.parent_path(); + if(exists(p / "etc")) { + root = p; + break; + } + } + if(p == p.root_directory()) + root = p; + } + return root; } int main(int argc, char** argv) { try { app().set_version(eosio::eosiod::config::version); + bfs::path root = determine_root_directory(); + app().set_default_data_dir(root / "var/lib/eosio/node_00"); + app().set_default_config_dir(root / "etc/eosio/node_00"); if(!app().initialize(argc, argv)) return -1; initialize_logging(); ilog("eosiod version ${ver}", ("ver", eosio::eosiod::config::itoh(static_cast(app().version())))); + ilog("eosio root is ${root}", ("root", root.string())); app().startup(); app().exec(); } catch (const fc::exception& e) { diff --git a/programs/eosiowd/CMakeLists.txt b/programs/eosiowd/CMakeLists.txt index cb8c51c25382231c60609e9bd00b5a8079f60d10..a39145e07d5379e797e9a800f819951482c68ca3 100644 --- a/programs/eosiowd/CMakeLists.txt +++ b/programs/eosiowd/CMakeLists.txt @@ -18,7 +18,7 @@ target_link_libraries( eosiowd install( TARGETS eosiowd - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} ) diff --git a/programs/eosiowd/main.cpp b/programs/eosiowd/main.cpp index 8147875173c45d2494cdafd5af85c4ebceeec874..a115f04f3443f84e59b1c260db1add43091b609a 100644 --- a/programs/eosiowd/main.cpp +++ b/programs/eosiowd/main.cpp @@ -13,14 +13,32 @@ #include +#include + using namespace appbase; using namespace eosio; +bfs::path determine_home_directory() +{ + bfs::path home; + struct passwd* pwd = getpwuid(getuid()); + if(pwd) { + home = pwd->pw_dir; + } + else { + home = getenv("HOME"); + } + if(home.empty()) + home = "./"; + return home; +} + int main(int argc, char** argv) { try { - app().register_plugin(); - app().register_plugin(); + bfs::path home = determine_home_directory(); + app().set_default_data_dir(home / "eosio-wallet"); + app().set_default_config_dir(home / "eosio-wallet"); app().register_plugin(); if(!app().initialize(argc, argv)) return -1; diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index e903d69ea07f4a61a5814ca368fd0a3064464399..16736a866b1bd1e09a6f630203e564e79b64f75a 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -3,3 +3,4 @@ configure_file(eosio-tn_bounce.sh eosio-tn_bounce.sh COPYONLY) configure_file(eosio-tn_down.sh eosio-tn_down.sh COPYONLY) configure_file(eosio-tn_roll.sh eosio-tn_roll.sh COPYONLY) configure_file(eosio-tn_up.sh eosio-tn_up.sh COPYONLY) +configure_file(abi_is_json.py abi_is_json.py COPYONLY) diff --git a/scripts/abi_is_json.py b/scripts/abi_is_json.py new file mode 100755 index 0000000000000000000000000000000000000000..6737a234c5cdf263e4df3579a51d44dab5e1d0e5 --- /dev/null +++ b/scripts/abi_is_json.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import json +import sys + +def json_validator(data): + try: + json.loads(data) + return True + except ValueError as error: + print("invalid json: %s" % error) + return False + +def test_json_validator(abi_name): + abi_file = open(abi_name,'r') + abi_text = abi_file.read() + abi_file.close() + return json_validator(abi_text) == True + +if __name__ == "__main__": + for filename in sys.argv[1:]: + print("Testing abi file ", filename) + if test_json_validator(filename): + exit(0) + else: + exit(1) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 154430f30d7d5f696b832fc22e522224d25c7eda..d13c1b962aa03b20e2dd11e0a6c64eb39b70e1b8 100644 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -24,11 +24,22 @@ exit 1 fi - if [ $OS_MIN -lt 4 ]; then - printf "\tYou must be running Ubuntu 16.04.x or higher to install EOSIO.\n" - printf "\tExiting now.\n" - exit 1 - fi + case $OS_NAME in + "Linux Mint") + if [ $OS_MAJ -lt 18 ]; then + printf "\tYou must be running Linux Mint 18.x or higher to install EOSIO.\n" + printf "\tExiting now.\n" + exit 1 + fi + ;; + "Ubuntu") + if [ $OS_MIN -lt 4 ]; then + printf "\tYou must be running Ubuntu 16.04.x or higher to install EOSIO.\n" + printf "\tExiting now.\n" + exit 1 + fi + ;; + esac if [ $DISK_AVAIL -lt $DISK_MIN ]; then printf "\tYou must have at least ${DISK_MIN}GB of available storage to install EOSIO.\n" diff --git a/tests/eosiod_run_test.py b/tests/eosiod_run_test.py index 80e8f09f5353b0aac44819643e8aaac4e9bbeda3..74cd8ee1c18f82b6aab6ad803bb1a0066cbe43a2 100755 --- a/tests/eosiod_run_test.py +++ b/tests/eosiod_run_test.py @@ -123,13 +123,13 @@ try: PUB_KEY2=currencyAccount.ownerPublicKey PRV_KEY3=exchangeAccount.activePrivateKey PUB_KEY3=exchangeAccount.activePublicKey - + testeraAccount.activePrivateKey=currencyAccount.activePrivateKey=PRV_KEY3 testeraAccount.activePublicKey=currencyAccount.activePublicKey=PUB_KEY3 exchangeAccount.ownerPrivateKey=PRV_KEY2 exchangeAccount.ownerPublicKey=PUB_KEY2 - + Print("Stand up walletd") if walletMgr.launch() is False: cmdError("%s" % (WalletdName)) @@ -154,7 +154,7 @@ try: if initaWallet is None: cmdError("eos wallet create") errorExit("Failed to create wallet %s." % (initaWalletName)) - + initaAccount=testUtils.Cluster.initaAccount initbAccount=testUtils.Cluster.initbAccount @@ -215,7 +215,7 @@ try: noMatch=list(set(expectedkeys) - set(actualKeys)) if len(noMatch) > 0: errorExit("FAILURE - wallet keys did not include %s" % (noMatch), raw=true) - + node=cluster.getNode(0) if node is None: errorExit("Cluster in bad state, received None node") @@ -441,7 +441,7 @@ try: opts="--permission currency@active" trans=node.pushMessage(contract, action, data, opts) - Print("Verify currency contract has proper initial balance") + Print("Verify currency contract has proper initial balance (via get table)") contract="currency" table="account" row0=node.getTableRow(currencyAccount.name, contract, table, 0) @@ -454,6 +454,24 @@ try: if row0[balanceKey] != 1000000000: errorExit("FAILURE - get table currency account failed", raw=True) + Print("Verify currency contract has proper initial balance (via get currency balance)") + res=node.getCurrencyBalance(contract, currencyAccount.name, "CUR") + if res is None: + cmdError("%s get currency balance" % (ClientName)) + errorExit("Failed to retrieve CUR balance from contract %s account %s" % (contract, currencyAccount.name)) + + if res.strip()[1:-1] != "100000.0000 CUR": + errorExit("FAILURE - get currency balance failed", raw=True) + + Print("Verify currency contract has proper total supply of CUR (via get currency stats)") + res=node.getCurrencyStats(contract, "CUR") + if res is None or not ("supply" in res): + cmdError("%s get currency stats" % (ClientName)) + errorExit("Failed to retrieve CUR stats from contract" % (contract)) + + if res["supply"] != "100000.0000 CUR": + errorExit("FAILURE - get currency stats failed", raw=True) + Print("push transfer action to currency contract") contract="currency" action="transfer" @@ -475,7 +493,7 @@ try: if not node.waitForTransIdOnNode(transId): cmdError("%s get transaction trans_id" % (ClientName)) errorExit("Failed to verify push message transaction id.") - + Print("read current contract balance") contract="currency" table="account" @@ -543,7 +561,7 @@ try: if trans is None: cmdError("%s set action permission set" % (ClientName)) errorExit("Failed to remove permission") - + Print("Locking all wallets.") if not walletMgr.lockAllWallets(): cmdError("%s wallet lock_all" % (ClientName)) @@ -599,7 +617,7 @@ try: # if trans2 is None: # errorExit("mongo get messages by transaction id %s" % (transId)) - + Print("Request invalid block numbered %d" % (currentBlockNum+1000)) block=node.getBlock(currentBlockNum+1000, silentErrors=True, retry=False) if block is not None: @@ -614,7 +632,7 @@ try: for line in errFile: if p.search(line): errorExit("FAILURE - Assert in tn_data_00/stderr.txt") - + testSuccessful=True Print("END") finally: diff --git a/tests/testUtils.py b/tests/testUtils.py index e6bd6d585a929693feff4010b20e33d38bc7e7fa..fad2c0b327305da30be0947d5ea45967b1304ab7 100755 --- a/tests/testUtils.py +++ b/tests/testUtils.py @@ -33,7 +33,7 @@ class Utils: EosLauncherPath="programs/eosio-launcher/eosio-launcher" MongoPath="mongo" - + @staticmethod def Print(*args, **kwargs): stackDepth=len(inspect.stack())-2 @@ -81,7 +81,7 @@ class Utils: @staticmethod def getChainStrategies(): chainSyncStrategies={} - + chainSyncStrategy=Utils.SyncStrategy(Utils.SyncNoneTag, 0, "") chainSyncStrategies[chainSyncStrategy.name]=chainSyncStrategy @@ -110,20 +110,20 @@ class Table(object): self.name=name self.keys=[] self.data=[] - + ########################################################################################### class Transaction(object): def __init__(self, transId): self.transId=transId self.tType=None self.amount=0 - + ########################################################################################### class Account(object): def __init__(self, name): self.name=name self.balance=0 - + self.ownerPrivateKey=None self.ownerPublicKey=None self.activePrivateKey=None @@ -207,7 +207,7 @@ class Node(object): except subprocess.CalledProcessError as ex: msg=ex.output return (ex.returncode, msg, None) - + return (0, outs, errs) @staticmethod @@ -216,7 +216,7 @@ class Node(object): tmpStr=re.sub(r'ObjectId\("(\w+)"\)', r'"ObjectId-\1"', tmpStr) tmpStr=re.sub(r'ISODate\("([\w|\-|\:|\.]+)"\)', r'"ISODate-\1"', tmpStr) return tmpStr - + @staticmethod def runMongoCmdReturnJson(cmdArr, subcommand, trace=False): retId,outs,errs=Node.stdinAndCheckOutput(cmdArr, subcommand) @@ -304,8 +304,8 @@ class Node(object): time.sleep(self.mongoSyncTime) return None - - + + def doesNodeHaveBlockNum(self, blockNum): assert isinstance(blockNum, int) @@ -346,7 +346,7 @@ class Node(object): if self.mongoSyncTime is not None: Utils.Debug and Utils.Print("cmd: sleep %d seconds" % (self.mongoSyncTime)) time.sleep(self.mongoSyncTime) - + return None def getTransByBlockId(self, blockId, retry=True, silentErrors=False): @@ -368,11 +368,11 @@ class Node(object): if self.mongoSyncTime is not None: Utils.Debug and Utils.Print("cmd: sleep %d seconds" % (self.mongoSyncTime)) time.sleep(self.mongoSyncTime) - + return None - - + + def getActionFromDb(self, transId, retry=True, silentErrors=False): for i in range(2): cmd="%s %s" % (Utils.MongoPath, self.mongoEndpointArgs) @@ -392,9 +392,9 @@ class Node(object): if self.mongoSyncTime is not None: Utils.Debug and Utils.Print("cmd: sleep %d seconds" % (self.mongoSyncTime)) time.sleep(self.mongoSyncTime) - + return None - + def getMessageFromDb(self, transId, retry=True, silentErrors=False): for i in range(2): cmd="%s %s" % (Utils.MongoPath, self.mongoEndpointArgs) @@ -414,7 +414,7 @@ class Node(object): if self.mongoSyncTime is not None: Utils.Debug and Utils.Print("cmd: sleep %d seconds" % (self.mongoSyncTime)) time.sleep(self.mongoSyncTime) - + return None def doesNodeHaveTransId(self, transId): @@ -441,7 +441,7 @@ class Node(object): Utils.Print("Publish eosio.system contract") trans=self.publishContract(eosio.name, wastFile, abiFile, waitForTransBlock=True) if trans is None: - Utils.errorExit("Failed to publish oesio.system.") + Utils.errorExit("Failed to publish eosio.system.") Utils.Print("push issue action to eosio contract") contract=eosio.name @@ -531,6 +531,17 @@ class Node(object): def getEosCurrencyBalance(self, name): cmd="%s %s get currency balance eosio %s EOS" % (Utils.EosClientPath, self.endpointArgs, name) Utils.Debug and Utils.Print("cmd: %s" % (cmd)) + try: + trans=Node.runCmdReturnStr(cmd) + return trans + except subprocess.CalledProcessError as ex: + msg=ex.output.decode("utf-8") + Utils.Print("ERROR: Exception during get EOS balance. %s" % (msg)) + return None + + def getCurrencyBalance(self, contract, account, symbol): + cmd="%s %s get currency balance %s %s %s" % (Utils.EosClientPath, self.endpointArgs, contract, account, symbol) + Utils.Debug and Utils.Print("cmd: %s" % (cmd)) try: trans=Node.runCmdReturnStr(cmd) return trans @@ -539,6 +550,17 @@ class Node(object): Utils.Print("ERROR: Exception during get currency balance. %s" % (msg)) return None + def getCurrencyStats(self, contract, symbol=""): + cmd="%s %s get currency stats %s %s" % (Utils.EosClientPath, self.endpointArgs, contract, symbol) + Utils.Debug and Utils.Print("cmd: %s" % (cmd)) + try: + trans=Node.runCmdReturnJson(cmd) + return trans + except subprocess.CalledProcessError as ex: + msg=ex.output.decode("utf-8") + Utils.Print("ERROR: Exception during get currency stats. %s" % (msg)) + return None + # Verifies account. Returns "get account" json return object def verifyAccount(self, account): if not self.enableMongo: @@ -563,7 +585,7 @@ class Node(object): time.sleep(self.mongoSyncTime) return None - + def waitForBlockNumOnNode(self, blockNum, timeout=None): if timeout is None: timeout=Utils.systemWaitTimeout @@ -604,7 +626,7 @@ class Node(object): Utils.Debug and Utils.Print("cmd: remaining time %d seconds" % (remainingTime)) num=self.getIrreversibleBlockNum() Utils.Debug and Utils.Print("Current block number: %s" % (num)) - + while time.time()-startTime < timeout: nextNum=self.getIrreversibleBlockNum() if nextNum > num: @@ -650,7 +672,7 @@ class Node(object): Utils.Print("ERROR: validateSpreadFunds> Expected total: %d , actual: %d" % ( expectedTotal, actualTotal)) return False - + return True def getSystemBalance(self, adminAccount, accounts): @@ -658,7 +680,7 @@ class Node(object): for account in accounts: balance += self.getAccountBalance(account.name) return balance - + # Gets accounts mapped to key. Returns json object def getAccountsByKey(self, key): cmd="%s %s get accounts %s" % (Utils.EosClientPath, self.endpointArgs, key) @@ -804,7 +826,7 @@ class Node(object): if waitForTransBlock and not self.waitForTransIdOnNode(transId): return None return trans - + def getTable(self, account, contract, table): cmd="%s %s get table %s %s %s" % (Utils.EosClientPath, self.endpointArgs, account, contract, table) Utils.Debug and Utils.Print("cmd: %s" % (cmd)) @@ -839,7 +861,7 @@ class Node(object): keys=list(row.keys()) return keys - # returns tuple with transaction and + # returns tuple with transaction and def pushMessage(self, contract, action, data, opts, silentErrors=False): cmd=None if Utils.amINoon: @@ -910,7 +932,7 @@ class Node(object): else: self.alive=False return False - + def getHeadBlockNum(self): if not self.enableMongo: info=self.getInfo() @@ -960,9 +982,9 @@ class WalletMgr(object): if not self.walletd: Utils.Print("ERROR: Wallet Manager wasn't configured to launch walletd") return False - - cmd="%s --data-dir %s --http-server-address=%s:%d" % ( - Utils.EosWalletPath, WalletMgr.__walletDataDir, self.host, self.port) + + cmd="%s --data-dir %s --config-dir %s --http-server-address=%s:%d" % ( + Utils.EosWalletPath, WalletMgr.__walletDataDir, WalletMgr.__walletDataDir, self.host, self.port) Utils.Print("cmd: %s" % (cmd)) with open(WalletMgr.__walletLogFile, 'w') as sout, open(WalletMgr.__walletLogFile, 'w') as serr: popen=subprocess.Popen(cmd.split(), stdout=sout, stderr=serr) @@ -989,7 +1011,7 @@ class WalletMgr(object): p=m.group(1) wallet=Wallet(name, p, self.host, self.port) self.wallets[name] = wallet - + return wallet def importKey(self, account, wallet): @@ -1087,7 +1109,7 @@ class WalletMgr(object): return keys - + def dumpErrorDetails(self): Utils.Print("=================================================================") if self.__walletPid is not None: @@ -1095,12 +1117,12 @@ class WalletMgr(object): Utils.Print("=================================================================") with open(WalletMgr.__walletLogFile, "r") as f: shutil.copyfileobj(f, sys.stdout) - + def killall(self): cmd="pkill %s" % (Utils.EosWalletName) Utils.Debug and Utils.Print("cmd: %s" % (cmd)) subprocess.call(cmd.split()) - + def cleanup(self): dataDir=WalletMgr.__walletDataDir if os.path.isdir(dataDir) and os.path.exists(dataDir): @@ -1168,7 +1190,7 @@ class Cluster(object): if not self.localCluster: Utils.Print("WARNING: Cluster not local, not launching %s." % (Utils.EosServerName)) return True - + if len(self.nodes) > 0: raise RuntimeError("Cluster already running.") @@ -1189,7 +1211,6 @@ class Cluster(object): cmdArr.append("--plugin eosio::mongo_db_plugin --resync --mongodb-uri %s" % self.mongoUri) else: cmdArr.append("--plugin eosio::db_plugin --mongodb-uri %s" % self.mongoUri) - Utils.Print("cmd: ", cmdArr) if 0 != subprocess.call(cmdArr): Utils.Print("ERROR: Launcher failed to launch.") @@ -1248,7 +1269,7 @@ class Cluster(object): self.nodes=nodes return True - + # manually set nodes, alternative to explicit launch def setNodes(self, nodes): self.nodes=nodes @@ -1315,7 +1336,7 @@ class Cluster(object): if m is None: Utils.Print("ERROR: Owner key creation regex mismatch") break - + ownerPrivate=m.group(1) ownerPublic=m.group(2) @@ -1326,7 +1347,7 @@ class Cluster(object): if m is None: Utils.Print("ERROR: Owner key creation regex mismatch") break - + activePrivate=m.group(1) activePublic=m.group(2) @@ -1387,7 +1408,7 @@ class Cluster(object): def getNodes(self): return self.nodes - + # Spread funds across accounts with transactions spread through cluster nodes. # Validate transactions are synchronized on root node def spreadFunds(self, amount=1): @@ -1425,14 +1446,14 @@ class Cluster(object): if nextInstanceFound is False: Utils.Print("ERROR: No active nodes found.") return False - + #Utils.Print("nextEosIdx: %d, count: %d" % (nextEosIdx, count)) node=self.nodes[nextEosIdx] Utils.Debug and Utils.Print("Wait for trasaction id %s on node port %d" % (transId, node.port)) if node.waitForTransIdOnNode(transId) is False: Utils.Print("ERROR: Selected node never received transaction id %s" % (transId)) return False - + transferAmount -= amount fromm=account to=self.accounts[i+1] if i < (count-1) else Cluster.initaAccount @@ -1456,7 +1477,7 @@ class Cluster(object): if node.waitForTransIdOnNode(transId) is False: Utils.Print("ERROR: Selected node never received transaction id %s" % (transId)) return False - + return True def validateSpreadFunds(self, expectedTotal): @@ -1516,7 +1537,7 @@ class Cluster(object): #Utils.Print("psOut: <%s>" % psOut) for i in range(0, totalNodes): - pattern="[\n]?(\d+) (.* --data-dir tn_data_%02d)\n" % (i) + pattern="[\n]?(\d+) (.* --data-dir tn_data_%02d)" % (i) m=re.search(pattern, psOut, re.MULTILINE) if m is None: Utils.Print("ERROR: Failed to find %s pid. Pattern %s" % (Utils.EosServerName, pattern)) @@ -1528,7 +1549,7 @@ class Cluster(object): except subprocess.CalledProcessError as ex: Utils.Print("ERROR: Exception during Nodes creation:", ex) raise - + return nodes # Check state of running eosiod process and update EosInstanceInfos @@ -1593,7 +1614,7 @@ class Cluster(object): Utils.Print("Contents of %s:" % (fileName)) with open(fileName, "r") as f: shutil.copyfileobj(f, sys.stdout) - + def killall(self): cmd="%s -k 15" % (Utils.EosLauncherPath) Utils.Debug and Utils.Print("cmd: %s" % (cmd)) @@ -1605,13 +1626,13 @@ class Cluster(object): os.kill(node.pid, signal.SIGKILL) except: pass - + def waitForNextBlock(self, timeout=None): if timeout is None: timeout=Utils.systemWaitTimeout node=self.nodes[0] return node.waitForNextBlock(timeout) - + def cleanup(self): for f in glob.glob("tn_data_*"): shutil.rmtree(f) @@ -1624,7 +1645,7 @@ class Cluster(object): if ret is not 0: Utils.Print("ERROR: Failed to drop database: %s" % (Node.byteArrToStr(errs)) ) - + # Create accounts and validates that the last transaction is received on root node def createAccounts(self, creator, waitForTransBlock=True, stakedDeposit=1000): if self.accounts is None: diff --git a/tests/tests/database_tests.cpp b/tests/tests/database_tests.cpp index d03ba98aa713046f9ba4500aaaab4292ab57ca78..f60a3ae8514a559a40405b23ebfedcb6858c44a0 100644 --- a/tests/tests/database_tests.cpp +++ b/tests/tests/database_tests.cpp @@ -65,9 +65,9 @@ BOOST_AUTO_TEST_SUITE(database_tests) if( max_reversible_rounds == 0) { return head_block_num - 1; } else { - const auto current_round = head_block_num / config::producer_repititions; + const auto current_round = head_block_num / config::producer_repetitions; const auto irreversible_round = current_round - max_reversible_rounds; - return (irreversible_round + 1) * config::producer_repititions - 1; + return (irreversible_round + 1) * config::producer_repetitions - 1; } }; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 3e3989f25c8b1b496de58e9fdcacc949eeddd0f8..7824b271b79a7ab9e1cc665d209b4965435408ad 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,5 +1,13 @@ configure_file( eosiocpp.in eosiocpp @ONLY) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/eosiocpp DESTINATION bin/ PERMISSIONS WORLD_EXECUTE OWNER_EXECUTE GROUP_EXECUTE WORLD_READ GROUP_READ OWNER_READ ) +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/eosiocpp DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + PERMISSIONS OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + GROUP_EXECUTE + WORLD_READ + WORLD_EXECUTE +) add_executable( print_floats print_floats.cpp ) target_link_libraries( print_floats PRIVATE ${Boost_LIBRARIES} ) diff --git a/tools/eosiocpp.in b/tools/eosiocpp.in index 49182aa4129c4cf900bfdc779e72a3e4aa3ff468..47bc2d2b0a3aeb76632f637bd6c11cbb6dd76f63 100755 --- a/tools/eosiocpp.in +++ b/tools/eosiocpp.in @@ -1,11 +1,15 @@ #!/bin/bash -EOSIO_INSTALL_DIR=@CMAKE_INSTALL_PREFIX@ +EOSIO_BIN_INSTALL_DIR=`dirname $0` +if [ "${EOSIO_BIN_INSTALL_DIR}" == "." ]; then + EOSIO_BIN_INSTALL_DIR=`pwd` +fi +EOSIO_INSTALL_DIR=`dirname ${EOSIO_BIN_INSTALL_DIR}` ABIGEN=${EOSIO_INSTALL_DIR}/bin/eosio-abigen BOOST_INCLUDE_DIR=@Boost_INCLUDE_DIR@ function copy_skeleton { set -e - cp -r ${EOSIO_INSTALL_DIR}/share/skeleton/. $newname + cp -r "${EOSIO_INSTALL_DIR}/share/eosio/skeleton/." $newname for file in $(find ./$newname -name 'skeleton.*') do