From e26c60d0252fce6bfcc1fbaf1e64ef8694a37a16 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Tue, 24 Jul 2018 17:52:23 -0400 Subject: [PATCH 01/27] installation changes --- CMakeLists.txt | 3 ++ eosio.version.in | 10 +++++ eosio_install.sh | 110 +++++++++++++++++++++++++++++++++++++++++++++ eosio_uninstall.sh | 35 +++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 eosio.version.in create mode 100755 eosio_install.sh create mode 100755 eosio_uninstall.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index e81d7e0a635..60133104e32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,6 +216,9 @@ install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio) install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio/launcher) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testnet.template ${CMAKE_CURRENT_BINARY_DIR}/etc/eosio/launcher/testnet.template COPYONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/eosio.version.in ${CMAKE_CURRENT_BINARY_DIR}/eosio.version.hpp) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eosio.version.hpp DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) + include(installer) include(doxygen) diff --git a/eosio.version.in b/eosio.version.in new file mode 100644 index 00000000000..239b7599404 --- /dev/null +++ b/eosio.version.in @@ -0,0 +1,10 @@ +#pragma once + +/// VERSION @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ +namespace eosio { + enum version { + MAJOR @VERSION_MAJOR@, + MINOR @VERSION_MINOR@, + PATCH @VERSION_PATCH@ + }; +} diff --git a/eosio_install.sh b/eosio_install.sh new file mode 100755 index 00000000000..ad6f029e669 --- /dev/null +++ b/eosio_install.sh @@ -0,0 +1,110 @@ +#!/bin/bash +########################################################################## +# This is the EOSIO automated install script for Linux and Mac OS. +# This file was downloaded from https://github.com/EOSIO/eos +# +# Copyright (c) 2017, Respective Authors all rights reserved. +# +# After June 1, 2018 this software is available under the following terms: +# +# The MIT License +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# https://github.com/EOSIO/eos/blob/master/LICENSE.txt +########################################################################## + + + CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + if [ "${CWD}" != "${PWD}" ]; then + printf "\\n\\tPlease cd into directory %s to run this script.\\n \\tExiting now.\\n\\n" "${CWD}" + exit 1 + fi + + BUILD_DIR="${PWD}/build" + CMAKE_BUILD_TYPE=Release + TIME_BEGIN=$( date -u +%s ) + INSTALL_PREFIX="/usr/local/eosio" + VERSION=1.2 + + txtbld=$(tput bold) + bldred=${txtbld}$(tput setaf 1) + txtrst=$(tput sgr0) + + create_symlink() { + pushd /usr/local/bin &> /dev/null + ln -sf ../eosio/bin/$1 $1 + popd &> /dev/null + } + + install_symlinks() { + printf "\\n\\tInstalling EOSIO Binary Symlinks\\n\\n" + create_symlink "cleos" + create_symlink "nodeos" + create_symlink "eosio-abigen" + create_symlink "eosio-applesdemo" + create_symlink "eosio-launcher" + create_symlink "eosio-s2wasm" + create_symlink "eosio-wast2wasm" + create_symlink "eosio-keosd" + } + + if [ ! -d "${BUILD_DIR}" ]; then + printf "\\n\\tError, eosio_build.sh has not ran. Please run ./eosio_build.sh first!\\n\\n" + exit -1 + fi + + ${PWD}/scripts/clean_old_install.sh + if [ $? -ne 0 ]; then + printf "\\n\\tError occurred while trying to remove old installation!\\n\\n" + exit -1 + fi + + if ! pushd "${BUILD_DIR}" + then + printf "Unable to enter build directory %s.\\n Exiting now.\\n" "${BUILD_DIR}" + exit 1; + fi + + if ! make install + then + printf "\\n\\t>>>>>>>>>>>>>>>>>>>> MAKE installing EOSIO has exited with the above error.\\n\\n" + exit -1 + fi + popd &> /dev/null + + install_symlinks + + printf "\n\n${bldred}\t _______ _______ _______ _________ _______\n" + printf '\t( ____ \( ___ )( ____ \\\\__ __/( ___ )\n' + printf "\t| ( \/| ( ) || ( \/ ) ( | ( ) |\n" + printf "\t| (__ | | | || (_____ | | | | | |\n" + printf "\t| __) | | | |(_____ ) | | | | | |\n" + printf "\t| ( | | | | ) | | | | | | |\n" + printf "\t| (____/\| (___) |/\____) |___) (___| (___) |\n" + printf "\t(_______/(_______)\_______)\_______/(_______)\n${txtrst}" + + printf "\\tTo verify your installation run the following commands:\\n" + + printf "\\tFor more information:\\n" + printf "\\tEOSIO website: https://eos.io\\n" + printf "\\tEOSIO Telegram channel @ https://t.me/EOSProject\\n" + printf "\\tEOSIO resources: https://eos.io/resources/\\n" + printf "\\tEOSIO Stack Exchange: https://eosio.stackexchange.com\\n" + printf "\\tEOSIO wiki: https://github.com/EOSIO/eos/wiki\\n\\n\\n" diff --git a/eosio_uninstall.sh b/eosio_uninstall.sh new file mode 100755 index 00000000000..22fdd01a11b --- /dev/null +++ b/eosio_uninstall.sh @@ -0,0 +1,35 @@ +#! /bin/bash + +binaries=(cleos + nodeos + eosio-keosd + eosio-abigen + eosio-applesdemo + eosio-launcher + eosio-s2wasm + eosio-wast2wasm) + +if [ -d "/usr/local/eosio" ]; then + printf "\tDo you wish to remove this install? (requires sudo)\n" + select yn in "Yes" "No"; do + case $yn in + [Yy]* ) + if [ "$(id -u)" -ne 0 ]; then + printf "\n\tThis requires sudo, please run ./scripts/clean_old_install.sh with sudo\n\n" + exit -1 + fi + + pushd /usr/local &> /dev/null + rm -rf eosio + pushd bin &> /dev/null + for binary in ${binaries[@]}; do + rm ${binary} + done + popd &> /dev/null + break;; + [Nn]* ) + printf "\tAborting uninstall\n\n" + exit -1;; + esac + done +fi From d4b1cd05676e0b1a6b3fb29ff174bdb40d9c6ab2 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 25 Jul 2018 14:24:17 -0400 Subject: [PATCH 02/27] Added generated cmake files --- CMakeLists.txt | 8 ++ CMakeModules/EosioTester.cmake.in | 96 ++++++++++++++++++++++ CMakeModules/EosioTesterBuild.cmake.in | 102 ++++++++++++++++++++++++ CMakeModules/EosioTesterCommon.cmake.in | 91 +++++++++++++++++++++ 4 files changed, 297 insertions(+) create mode 100644 CMakeModules/EosioTester.cmake.in create mode 100644 CMakeModules/EosioTesterBuild.cmake.in create mode 100644 CMakeModules/EosioTesterCommon.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 60133104e32..d1f1b93fc0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,8 @@ if ("${OPENSSL_ROOT_DIR}" STREQUAL "") endif() endif() +find_package(Secp256k1 REQUIRED) + if(UNIX) if(APPLE) set(whole_archive_flag "-force_load") @@ -219,6 +221,12 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testnet.template ${CMAKE_CURRENT_BINA configure_file(${CMAKE_CURRENT_SOURCE_DIR}/eosio.version.in ${CMAKE_CURRENT_BINARY_DIR}/eosio.version.hpp) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eosio.version.hpp DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/EosioTesterCommon.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/EosioTesterCommon.cmake @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/EosioTester.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/EosioTester.cmake @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/EosioTesterBuild.cmake.in ${CMAKE_BINARY_DIR}/lib/cmake/EosioTester.cmake @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/EosioTester.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/EosioTesterCommon.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/) + include(installer) include(doxygen) diff --git a/CMakeModules/EosioTester.cmake.in b/CMakeModules/EosioTester.cmake.in new file mode 100644 index 00000000000..bf2d38a0ff3 --- /dev/null +++ b/CMakeModules/EosioTester.cmake.in @@ -0,0 +1,96 @@ +cmake_minimum_required( VERSION 3.5 ) + +include(EosioTesterCommon) + +find_library(libtester eosio_testing @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libchain eosio_chain @CMAKE_INSTALL_FULL_LIBDIR@) +if ( "${CMAKE_BUILD_TYPE}" EQUAL "Debug" ) + find_library(libfc fc_debug @CMAKE_INSTALL_FULL_LIBDIR@) +else() + find_library(libfc fc @CMAKE_INSTALL_FULL_LIBDIR@) +endif() + +find_library(libbinaryen binaryen @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libwasm WASM @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libwast WAST @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libir IR @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libplatform Platform @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(liblogging Logging @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libruntime Runtime @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libsoftfloat softfloat @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(liboscrypto crypto @OPENSSL_ROOT_DIR@/lib) +find_library(libosssl ssl @OPENSSL_ROOT_DIR@/lib) +find_library(libchainbase chainbase @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libbuiltins builtins @CMAKE_INSTALL_FULL_LIBDIR@) +find_library(libsecp256k1 secp256k1 @Secp256k1_ROOT_DIR@/lib) + +macro(add_eosio_test test_name) + add_executable( ${test_name} ${ARGN} ) + target_link_libraries( ${test_name} + ${LLVM} + ${libtester} + ${libchain} + ${libfc} + ${libbinaryen} + ${libwast} + ${libwasm} + ${libruntime} + ${libplatform} + ${libir} + ${libsoftfloat} + ${liboscrypto} + ${libosssl} + ${liblogging} + ${libchainbase} + ${libbuiltins} + ${libsecp256k1} + + LLVMX86Disassembler + LLVMX86AsmParser + LLVMX86AsmPrinter + LLVMX86CodeGen + + LLVMSelectionDAG + + LLVMDebugInfoDWARF + LLVMAsmPrinter + LLVMMCParser + LLVMX86Info + + LLVMOrcJIT + LLVMExecutionEngine + + LLVMCodeGen + LLVMScalarOpts + LLVMTransformUtils + + LLVMipo + LLVMAnalysis + LLVMTarget + LLVMMC + LLVMCore + LLVMSupport + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_CHRONO_LIBRARY} + ${Boost_IOSTREAMS_LIBRARY} + ${Boost_DATE_TIME_LIBRARY} + ${PLATFORM_SPECIFIC_LIBS} + ) + + target_include_directories( ${test_name} PUBLIC + ${Boost_INCLUDE_DIRS} + @OPENSSL_INCLUDE_DIR@ + @CMAKE_INSTALL_PREFIX@ + @CMAKE_INSTALL_FULL_INCLUDEDIR@ + @CMAKE_INSTALL_FULL_INCLUDEDIR@/eosio/wasm-jit/Include + @CMAKE_INSTALL_FULL_INCLUDEDIR@/eosio/softfloat/include + ${CMAKE_CURRENT_BINARY_DIR}/include ) + # + #Manually run unit_test for all supported runtimes + #To run unit_test with all log from blockchain displayed, put --verbose after --, i.e. unit_test -- --verbose + add_test(NAME ${test_name}_binaryen COMMAND ${test_name} + --report_level=detailed --color_output -- --binaryen) + add_test(NAME ${test_name}_wavm COMMAND ${test_name} + --report_level=detailed --color_output --catch_system_errors=no -- --wavm) +endmacro() diff --git a/CMakeModules/EosioTesterBuild.cmake.in b/CMakeModules/EosioTesterBuild.cmake.in new file mode 100644 index 00000000000..3a05a40d197 --- /dev/null +++ b/CMakeModules/EosioTesterBuild.cmake.in @@ -0,0 +1,102 @@ +cmake_minimum_required( VERSION 3.5 ) + +include(EosioTesterCommon) + +find_library(libtester eosio_testing @CMAKE_BINARY_DIR@/libraries/testing) +find_library(libchain eosio_chain @CMAKE_BINARY_DIR@/libraries/chain) +if ( "${CMAKE_BUILD_TYPE}" EQUAL "Debug" ) + find_library(libfc fc_debug @CMAKE_BINARY_DIR@/libraries/fc) +else() + find_library(libfc fc @CMAKE_BINARY_DIR@/libraries/fc) +endif() + +find_library(libbinaryen binaryen @CMAKE_BINARY_DIR@/externals/binaryen/lib) +find_library(libwasm WASM @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/WASM) +find_library(libwast WAST @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/WAST) +find_library(libir IR @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/IR) +find_library(libplatform Platform @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/Platform) +find_library(liblogging Logging @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/Logging) +find_library(libruntime Runtime @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/Runtime) +find_library(libsoftfloat softfloat @CMAKE_BINARY_DIR@/libraries/softfloat) +find_library(liboscrypto crypto @OPENSSL_ROOT_DIR@/lib) +find_library(libosssl ssl @OPENSSL_ROOT_DIR@/lib) +find_library(libchainbase chainbase @CMAKE_BINARY_DIR@/libraries/chainbase) +find_library(libbuiltins builtins @CMAKE_BINARY_DIR@/libraries/builtins) +find_library(libsecp256k1 secp256k1 @Secp256k1_ROOT_DIR@/lib) + +macro(add_eosio_test test_name) + add_executable( ${test_name} ${ARGN} ) + target_link_libraries( ${test_name} + ${LLVM} + ${libtester} + ${libchain} + ${libfc} + ${libbinaryen} + ${libwast} + ${libwasm} + ${libruntime} + ${libplatform} + ${libir} + ${libsoftfloat} + ${liboscrypto} + ${libosssl} + ${liblogging} + ${libchainbase} + ${libbuiltins} + ${libsecp256k1} + + LLVMX86Disassembler + LLVMX86AsmParser + LLVMX86AsmPrinter + LLVMX86CodeGen + + LLVMSelectionDAG + + LLVMDebugInfoDWARF + LLVMAsmPrinter + LLVMMCParser + LLVMX86Info + + LLVMOrcJIT + LLVMExecutionEngine + + LLVMCodeGen + LLVMScalarOpts + LLVMTransformUtils + + LLVMipo + LLVMAnalysis + LLVMTarget + LLVMMC + LLVMCore + LLVMSupport + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_CHRONO_LIBRARY} + ${Boost_IOSTREAMS_LIBRARY} + ${Boost_DATE_TIME_LIBRARY} + ${PLATFORM_SPECIFIC_LIBS} + ) + + target_include_directories( ${test_name} PUBLIC + ${Boost_INCLUDE_DIRS} + @OPENSSL_INCLUDE_DIR@ + @CMAKE_SOURCE_DIR@/libraries/chain/include + @CMAKE_BINARY_DIR@/libraries/chain/include + @CMAKE_SOURCE_DIR@/libraries/fc/include + @CMAKE_SOURCE_DIR@/libraries/softfloat/source/include + @CMAKE_SOURCE_DIR@/libraries/softfloat/build/Linux-x86_64-GCC + @CMAKE_SOURCE_DIR@/libraries/softfloat/source/8086-SSE + @CMAKE_SOURCE_DIR@/libraries/chainbase/include + @CMAKE_SOURCE_DIR@/libraries/builtins + @CMAKE_SOURCE_DIR@/libraries/testing/include + @CMAKE_SOURCE_DIR@/libraries/wasm-jit/Include + ${CMAKE_CURRENT_BINARY_DIR}/include ) + # + #Manually run unit_test for all supported runtimes + #To run unit_test with all log from blockchain displayed, put --verbose after --, i.e. unit_test -- --verbose + add_test(NAME ${test_name}_binaryen COMMAND ${test_name} + --report_level=detailed --color_output -- --binaryen) + add_test(NAME ${test_name}_wavm COMMAND ${test_name} + --report_level=detailed --color_output --catch_system_errors=no -- --wavm) +endmacro() diff --git a/CMakeModules/EosioTesterCommon.cmake.in b/CMakeModules/EosioTesterCommon.cmake.in new file mode 100644 index 00000000000..f9ebf431260 --- /dev/null +++ b/CMakeModules/EosioTesterCommon.cmake.in @@ -0,0 +1,91 @@ +cmake_minimum_required( VERSION 3.5 ) + +set(EOSIO_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@") + +enable_testing() + +find_package( Gperftools QUIET ) +if( GPERFTOOLS_FOUND ) + message( STATUS "Found gperftools; compiling tests with TCMalloc") + list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) +endif() + +find_package(LLVM 4.0 REQUIRED CONFIG) + +link_directories(${LLVM_LIBRARY_DIR}) + +set( CMAKE_CXX_STANDARD 14 ) +set( CMAKE_CXX_EXTENSIONS ON ) +set( CXX_STANDARD_REQUIRED ON ) + +set(CMAKE_CXX_COMPILER @CMAKE_CXX_COMPILER@ FORCE CACHE STRING "C++ compiler") +set(CMAKE_C_COMPILER @CMAKE_C_COMPILER@ FORCE CACHE STRING "C compiler") + +if ( APPLE ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations" ) +else ( APPLE ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") +endif ( APPLE ) + +if (NOT "@BOOST_ROOT@" EQUAL "") + set(BOOST_ROOT @BOOST_ROOT@) +endif() + +set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" ) +find_package(Boost 1.67 REQUIRED COMPONENTS + date_time + filesystem + system + chrono + iostreams + date_time + unit_test_framework) + +if(ENABLE_COVERAGE_TESTING) + + set(Coverage_NAME ${PROJECT_NAME}_ut_coverage) + + if(NOT LCOV_PATH) + message(FATAL_ERROR "lcov not found! Aborting...") + endif() # NOT LCOV_PATH + + if(NOT LLVMCOV_PATH) + message(FATAL_ERROR "llvm-cov not found! Aborting...") + endif() # NOT LCOV_PATH + + if(NOT GENHTML_PATH) + message(FATAL_ERROR "genhtml not found! Aborting...") + endif() # NOT GENHTML_PATH + + # no spaces allowed within tests list + set(ctest_tests 'unit_test_binaryen|unit_test_wavm') + set(ctest_exclude_tests '') + + # Setup target + add_custom_target(${Coverage_NAME} + + # Cleanup lcov + COMMAND ${LCOV_PATH} --directory . --zerocounters + + # Run tests + COMMAND ./tools/ctestwrapper.sh -R ${ctest_tests} -E ${ctest_exclude_tests} + + COMMAND ${LCOV_PATH} --directory . --capture --gcov-tool ./tools/llvm-gcov.sh --output-file ${Coverage_NAME}.info + + COMMAND ${LCOV_PATH} -remove ${Coverage_NAME}.info '*/boost/*' '/usr/lib/*' '/usr/include/*' '*/externals/*' '*/fc/*' '*/wasm-jit/*' --output-file ${Coverage_NAME}_filtered.info + + COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info + + COMMAND if [ "$CI" != "true" ]\; then ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.base ${Coverage_NAME}.info ${Coverage_NAME}_filtered.info ${Coverage_NAME}.total ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info.cleaned\; fi + + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT "Resetting code coverage counters to zero. Processing code coverage counters and generating report. Report published in ./${Coverage_NAME}" + ) + + # Show info where to find the report + add_custom_command(TARGET ${Coverage_NAME} POST_BUILD + COMMAND ; + COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." + ) +endif() From d2d42f910d59a902ef0f998c6106b14b41a9ca76 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 25 Jul 2018 15:14:46 -0400 Subject: [PATCH 03/27] Update eosio_uninstall.sh --- eosio_uninstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eosio_uninstall.sh b/eosio_uninstall.sh index 22fdd01a11b..4b559eb5024 100755 --- a/eosio_uninstall.sh +++ b/eosio_uninstall.sh @@ -15,7 +15,7 @@ if [ -d "/usr/local/eosio" ]; then case $yn in [Yy]* ) if [ "$(id -u)" -ne 0 ]; then - printf "\n\tThis requires sudo, please run ./scripts/clean_old_install.sh with sudo\n\n" + printf "\n\tThis requires sudo, please run ./eosio_uninstall.sh with sudo\n\n" exit -1 fi From 04b3122565d15476122cdf565775c11681b125fb Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Fri, 27 Jul 2018 02:37:56 -0400 Subject: [PATCH 04/27] Fixing errors with linking --- CMakeLists.txt | 2 - CMakeModules/EosioTester.cmake.in | 43 +++++++++++- CMakeModules/EosioTesterBuild.cmake.in | 87 ++++++++++++++++++++++- CMakeModules/EosioTesterCommon.cmake.in | 91 ------------------------- libraries/CMakeLists.txt | 1 - libraries/chainbase | 2 +- 6 files changed, 128 insertions(+), 98 deletions(-) delete mode 100644 CMakeModules/EosioTesterCommon.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index d1f1b93fc0d..eb525e60e46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,11 +221,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testnet.template ${CMAKE_CURRENT_BINA configure_file(${CMAKE_CURRENT_SOURCE_DIR}/eosio.version.in ${CMAKE_CURRENT_BINARY_DIR}/eosio.version.hpp) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eosio.version.hpp DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/EosioTesterCommon.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/EosioTesterCommon.cmake @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/EosioTester.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/EosioTester.cmake @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/EosioTesterBuild.cmake.in ${CMAKE_BINARY_DIR}/lib/cmake/EosioTester.cmake @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/EosioTester.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/EosioTesterCommon.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/) include(installer) diff --git a/CMakeModules/EosioTester.cmake.in b/CMakeModules/EosioTester.cmake.in index bf2d38a0ff3..2bc75c05369 100644 --- a/CMakeModules/EosioTester.cmake.in +++ b/CMakeModules/EosioTester.cmake.in @@ -1,6 +1,43 @@ cmake_minimum_required( VERSION 3.5 ) -include(EosioTesterCommon) +set(CMAKE_CXX_COMPILER @CMAKE_CXX_COMPILER@) +set(CMAKE_C_COMPILER @CMAKE_C_COMPILER@) + +set(EOSIO_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@") + +enable_testing() + +find_package( Gperftools QUIET ) +if( GPERFTOOLS_FOUND ) + message( STATUS "Found gperftools; compiling tests with TCMalloc") + list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) +endif() + +find_package(LLVM 4.0 REQUIRED CONFIG) + +link_directories(${LLVM_LIBRARY_DIR}) + +set( CMAKE_CXX_STANDARD 14 ) +set( CMAKE_CXX_EXTENSIONS ON ) +set( CXX_STANDARD_REQUIRED ON ) + +if ( APPLE ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations" ) + set( BOOST_ROOT "/usr/local/boost" ) +else ( APPLE ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") + set( BOOST_ROOT "~/opt/boost" ) +endif ( APPLE ) + +set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" ) +find_package(Boost 1.67 REQUIRED COMPONENTS + date_time + filesystem + system + chrono + iostreams + unit_test_framework) find_library(libtester eosio_testing @CMAKE_INSTALL_FULL_LIBDIR@) find_library(libchain eosio_chain @CMAKE_INSTALL_FULL_LIBDIR@) @@ -78,15 +115,17 @@ macro(add_eosio_test test_name) ${PLATFORM_SPECIFIC_LIBS} ) + #### TODO /usr/local/include is a hack for fc and some other includes target_include_directories( ${test_name} PUBLIC ${Boost_INCLUDE_DIRS} @OPENSSL_INCLUDE_DIR@ @CMAKE_INSTALL_PREFIX@ @CMAKE_INSTALL_FULL_INCLUDEDIR@ + @CMAKE_INSTALL_FULL_INCLUDEDIR@/eosio @CMAKE_INSTALL_FULL_INCLUDEDIR@/eosio/wasm-jit/Include @CMAKE_INSTALL_FULL_INCLUDEDIR@/eosio/softfloat/include ${CMAKE_CURRENT_BINARY_DIR}/include ) - # + #Manually run unit_test for all supported runtimes #To run unit_test with all log from blockchain displayed, put --verbose after --, i.e. unit_test -- --verbose add_test(NAME ${test_name}_binaryen COMMAND ${test_name} diff --git a/CMakeModules/EosioTesterBuild.cmake.in b/CMakeModules/EosioTesterBuild.cmake.in index 3a05a40d197..cb1fee88c85 100644 --- a/CMakeModules/EosioTesterBuild.cmake.in +++ b/CMakeModules/EosioTesterBuild.cmake.in @@ -1,6 +1,43 @@ cmake_minimum_required( VERSION 3.5 ) -include(EosioTesterCommon) +set(CMAKE_CXX_COMPILER @CMAKE_CXX_COMPILER@) +set(CMAKE_C_COMPILER @CMAKE_C_COMPILER@) + +set(EOSIO_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@") + +enable_testing() + +find_package( Gperftools QUIET ) +if( GPERFTOOLS_FOUND ) + message( STATUS "Found gperftools; compiling tests with TCMalloc") + list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) +endif() + +find_package(LLVM 4.0 REQUIRED CONFIG) + +link_directories(${LLVM_LIBRARY_DIR}) + +set( CMAKE_CXX_STANDARD 14 ) +set( CMAKE_CXX_EXTENSIONS ON ) +set( CXX_STANDARD_REQUIRED ON ) + +if ( APPLE ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations" ) + set( BOOST_ROOT "/usr/local/boost" ) +else ( APPLE ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") + set( BOOST_ROOT "~/opt/boost" ) +endif ( APPLE ) + +set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" ) +find_package(Boost 1.67 REQUIRED COMPONENTS + date_time + filesystem + system + chrono + iostreams + unit_test_framework) find_library(libtester eosio_testing @CMAKE_BINARY_DIR@/libraries/testing) find_library(libchain eosio_chain @CMAKE_BINARY_DIR@/libraries/chain) @@ -100,3 +137,51 @@ macro(add_eosio_test test_name) add_test(NAME ${test_name}_wavm COMMAND ${test_name} --report_level=detailed --color_output --catch_system_errors=no -- --wavm) endmacro() + +if(ENABLE_COVERAGE_TESTING) + + set(Coverage_NAME ${PROJECT_NAME}_ut_coverage) + + if(NOT LCOV_PATH) + message(FATAL_ERROR "lcov not found! Aborting...") + endif() # NOT LCOV_PATH + + if(NOT LLVMCOV_PATH) + message(FATAL_ERROR "llvm-cov not found! Aborting...") + endif() # NOT LCOV_PATH + + if(NOT GENHTML_PATH) + message(FATAL_ERROR "genhtml not found! Aborting...") + endif() # NOT GENHTML_PATH + + # no spaces allowed within tests list + set(ctest_tests 'unit_test_binaryen|unit_test_wavm') + set(ctest_exclude_tests '') + + # Setup target + add_custom_target(${Coverage_NAME} + + # Cleanup lcov + COMMAND ${LCOV_PATH} --directory . --zerocounters + + # Run tests + COMMAND ./tools/ctestwrapper.sh -R ${ctest_tests} -E ${ctest_exclude_tests} + + COMMAND ${LCOV_PATH} --directory . --capture --gcov-tool ./tools/llvm-gcov.sh --output-file ${Coverage_NAME}.info + + COMMAND ${LCOV_PATH} -remove ${Coverage_NAME}.info '*/boost/*' '/usr/lib/*' '/usr/include/*' '*/externals/*' '*/fc/*' '*/wasm-jit/*' --output-file ${Coverage_NAME}_filtered.info + + COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info + + COMMAND if [ "$CI" != "true" ]\; then ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.base ${Coverage_NAME}.info ${Coverage_NAME}_filtered.info ${Coverage_NAME}.total ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info.cleaned\; fi + + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT "Resetting code coverage counters to zero. Processing code coverage counters and generating report. Report published in ./${Coverage_NAME}" + ) + + # Show info where to find the report + add_custom_command(TARGET ${Coverage_NAME} POST_BUILD + COMMAND ; + COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." + ) +endif() diff --git a/CMakeModules/EosioTesterCommon.cmake.in b/CMakeModules/EosioTesterCommon.cmake.in deleted file mode 100644 index f9ebf431260..00000000000 --- a/CMakeModules/EosioTesterCommon.cmake.in +++ /dev/null @@ -1,91 +0,0 @@ -cmake_minimum_required( VERSION 3.5 ) - -set(EOSIO_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@") - -enable_testing() - -find_package( Gperftools QUIET ) -if( GPERFTOOLS_FOUND ) - message( STATUS "Found gperftools; compiling tests with TCMalloc") - list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) -endif() - -find_package(LLVM 4.0 REQUIRED CONFIG) - -link_directories(${LLVM_LIBRARY_DIR}) - -set( CMAKE_CXX_STANDARD 14 ) -set( CMAKE_CXX_EXTENSIONS ON ) -set( CXX_STANDARD_REQUIRED ON ) - -set(CMAKE_CXX_COMPILER @CMAKE_CXX_COMPILER@ FORCE CACHE STRING "C++ compiler") -set(CMAKE_C_COMPILER @CMAKE_C_COMPILER@ FORCE CACHE STRING "C compiler") - -if ( APPLE ) - set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations" ) -else ( APPLE ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") -endif ( APPLE ) - -if (NOT "@BOOST_ROOT@" EQUAL "") - set(BOOST_ROOT @BOOST_ROOT@) -endif() - -set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" ) -find_package(Boost 1.67 REQUIRED COMPONENTS - date_time - filesystem - system - chrono - iostreams - date_time - unit_test_framework) - -if(ENABLE_COVERAGE_TESTING) - - set(Coverage_NAME ${PROJECT_NAME}_ut_coverage) - - if(NOT LCOV_PATH) - message(FATAL_ERROR "lcov not found! Aborting...") - endif() # NOT LCOV_PATH - - if(NOT LLVMCOV_PATH) - message(FATAL_ERROR "llvm-cov not found! Aborting...") - endif() # NOT LCOV_PATH - - if(NOT GENHTML_PATH) - message(FATAL_ERROR "genhtml not found! Aborting...") - endif() # NOT GENHTML_PATH - - # no spaces allowed within tests list - set(ctest_tests 'unit_test_binaryen|unit_test_wavm') - set(ctest_exclude_tests '') - - # Setup target - add_custom_target(${Coverage_NAME} - - # Cleanup lcov - COMMAND ${LCOV_PATH} --directory . --zerocounters - - # Run tests - COMMAND ./tools/ctestwrapper.sh -R ${ctest_tests} -E ${ctest_exclude_tests} - - COMMAND ${LCOV_PATH} --directory . --capture --gcov-tool ./tools/llvm-gcov.sh --output-file ${Coverage_NAME}.info - - COMMAND ${LCOV_PATH} -remove ${Coverage_NAME}.info '*/boost/*' '/usr/lib/*' '/usr/include/*' '*/externals/*' '*/fc/*' '*/wasm-jit/*' --output-file ${Coverage_NAME}_filtered.info - - COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info - - COMMAND if [ "$CI" != "true" ]\; then ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.base ${Coverage_NAME}.info ${Coverage_NAME}_filtered.info ${Coverage_NAME}.total ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info.cleaned\; fi - - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - COMMENT "Resetting code coverage counters to zero. Processing code coverage counters and generating report. Report published in ./${Coverage_NAME}" - ) - - # Show info where to find the report - add_custom_command(TARGET ${Coverage_NAME} POST_BUILD - COMMAND ; - COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." - ) -endif() diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt index ce3fe3c6db0..9bf5d72813b 100644 --- a/libraries/CMakeLists.txt +++ b/libraries/CMakeLists.txt @@ -9,5 +9,4 @@ add_subdirectory( chain ) add_subdirectory( testing ) add_subdirectory( abi_generator ) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/chainbase/include/chainbase DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/include DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/softfloat) diff --git a/libraries/chainbase b/libraries/chainbase index 94c54460bfa..621dcc17970 160000 --- a/libraries/chainbase +++ b/libraries/chainbase @@ -1 +1 @@ -Subproject commit 94c54460bfa391aef6cadf1e3f8a4eb384c8b58e +Subproject commit 621dcc17970a5feb27cd1dda6e5163130c22d486 From f5e2acc69adecf203bd533bf7348bda8e97c70ec Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Fri, 27 Jul 2018 03:02:25 -0400 Subject: [PATCH 05/27] updated submodules --- libraries/CMakeLists.txt | 2 -- libraries/chainbase | 2 +- libraries/softfloat | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt index 9bf5d72813b..a36e79cf5d2 100644 --- a/libraries/CMakeLists.txt +++ b/libraries/CMakeLists.txt @@ -8,5 +8,3 @@ add_subdirectory( appbase ) add_subdirectory( chain ) add_subdirectory( testing ) add_subdirectory( abi_generator ) - -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/include DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/softfloat) diff --git a/libraries/chainbase b/libraries/chainbase index 621dcc17970..0a347683902 160000 --- a/libraries/chainbase +++ b/libraries/chainbase @@ -1 +1 @@ -Subproject commit 621dcc17970a5feb27cd1dda6e5163130c22d486 +Subproject commit 0a347683902f3ebbf58a4dd6166d68d967e240ce diff --git a/libraries/softfloat b/libraries/softfloat index 9dff375a6e3..23ec8abd95e 160000 --- a/libraries/softfloat +++ b/libraries/softfloat @@ -1 +1 @@ -Subproject commit 9dff375a6e3a9728a024b30afa127c88fcb40ea2 +Subproject commit 23ec8abd95eb0fb6c73d4c4c0315794187b74e6a From 517b3a087f3145c511ea2336fc1db2665b2dd464 Mon Sep 17 00:00:00 2001 From: arhag Date: Mon, 30 Jul 2018 15:46:51 -0400 Subject: [PATCH 06/27] clean old libraries in clean_old_install.sh script --- scripts/clean_old_install.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/clean_old_install.sh b/scripts/clean_old_install.sh index f4dcdb610bd..edadefd33d6 100755 --- a/scripts/clean_old_install.sh +++ b/scripts/clean_old_install.sh @@ -19,6 +19,26 @@ if [ -d "/usr/local/include/eosio" ]; then rm cleos eosio-abigen eosio-applesdemo eosio-launcher eosio-s2wasm eosio-wast2wasm eosiocpp keosd nodeos &> /dev/null popd &> /dev/null + libraries=(libeosio_testing + libeosio_chain + libfc + libbinaryen + libWAST + libWASM + libRuntime + libPlatform + libIR + libLogging + libsoftfloat + libchainbase + libappbase + libbuiltins) + pushd lib &> /dev/null + for lib in ${libraries[@]}; do + rm ${lib}.a ${lib}.dylib &> /dev/null + done + popd &> /dev/null + pushd etc &> /dev/null rm eosio &> /dev/null popd &> /dev/null @@ -39,7 +59,7 @@ if [ -d "/usr/local/include/eosio" ]; then rm eosio &> /dev/null popd &> /dev/null break;; - [Nn]* ) + [Nn]* ) printf "\tAborting uninstall\n\n" exit -1;; esac From 0e7555f31b6a4f9419305c21adb2d1a2b5a84724 Mon Sep 17 00:00:00 2001 From: arhag Date: Mon, 30 Jul 2018 15:57:00 -0400 Subject: [PATCH 07/27] also remove .so extension libs during clean_old_install --- scripts/clean_old_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/clean_old_install.sh b/scripts/clean_old_install.sh index edadefd33d6..44306068df1 100755 --- a/scripts/clean_old_install.sh +++ b/scripts/clean_old_install.sh @@ -35,7 +35,7 @@ if [ -d "/usr/local/include/eosio" ]; then libbuiltins) pushd lib &> /dev/null for lib in ${libraries[@]}; do - rm ${lib}.a ${lib}.dylib &> /dev/null + rm ${lib}.a ${lib}.dylib ${lib}.so &> /dev/null done popd &> /dev/null From 8c453896b2bf26ab0945a408286ce507768ff044 Mon Sep 17 00:00:00 2001 From: Bart Wyatt Date: Tue, 31 Jul 2018 18:06:45 -0400 Subject: [PATCH 08/27] Remove the redundant signature recovery and block digest when applying trusted/pre-validated blocks --- libraries/chain/block_header_state.cpp | 7 +++---- libraries/chain/controller.cpp | 13 +++++++++---- .../include/eosio/chain/block_header_state.hpp | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libraries/chain/block_header_state.cpp b/libraries/chain/block_header_state.cpp index dc7a2264101..6e7b339c42c 100644 --- a/libraries/chain/block_header_state.cpp +++ b/libraries/chain/block_header_state.cpp @@ -177,6 +177,7 @@ namespace eosio { namespace chain { result.header.producer_signature = h.producer_signature; result.id = result.header.id(); + // ASSUMPTION FROM controller_impl::apply_block = all untrusted blocks will have their signatures pre-validated here if( !trust ) { EOS_ASSERT( result.block_signing_key == result.signee(), wrong_signing_key, "block not signed by expected key", ("result.block_signing_key", result.block_signing_key)("signee", result.signee() ) ); @@ -225,12 +226,10 @@ namespace eosio { namespace chain { return digest_type::hash( std::make_pair(header_bmroot, pending_schedule_hash) ); } - void block_header_state::sign( const std::function& signer, bool trust ) { + void block_header_state::sign( const std::function& signer ) { auto d = sig_digest(); header.producer_signature = signer( d ); - if( !trust ) { - EOS_ASSERT( block_signing_key == fc::crypto::public_key( header.producer_signature, d ), wrong_signing_key, "block is signed with unexpected key" ); - } + EOS_ASSERT( block_signing_key == fc::crypto::public_key( header.producer_signature, d ), wrong_signing_key, "block is signed with unexpected key" ); } public_key_type block_header_state::signee()const { diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 408f694f71f..46a1b729039 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -828,10 +828,10 @@ struct controller_impl { - void sign_block( const std::function& signer_callback, bool trust ) { + void sign_block( const std::function& signer_callback ) { auto p = pending->_pending_block_state; - p->sign( signer_callback, false); //trust ); + p->sign( signer_callback ); static_cast(*p->block) = p->header; } /// sign_block @@ -877,7 +877,12 @@ struct controller_impl { } finalize_block(); - sign_block( [&]( const auto& ){ return b->producer_signature; }, false ); //trust ); + + // we can always trust this signature because, + // - prior to apply_block, we call fork_db.add which does a signature check IFF the block is untrusted + // - OTHERWISE the block is trusted and therefore we trust that the signature is valid + // Also, as ::sign_block does not lazily calculate the digest of the block, we can just short-circuit to save cycles + pending->_pending_block_state->header.producer_signature = b->producer_signature; // this is implied by the signature passing //FC_ASSERT( b->id() == pending->_pending_block_state->block->id(), @@ -1274,7 +1279,7 @@ void controller::finalize_block() { } void controller::sign_block( const std::function& signer_callback ) { - my->sign_block( signer_callback, false /* don't trust */); + my->sign_block( signer_callback ); } void controller::commit_block() { diff --git a/libraries/chain/include/eosio/chain/block_header_state.hpp b/libraries/chain/include/eosio/chain/block_header_state.hpp index 2287fcaef0e..ecd272353d4 100644 --- a/libraries/chain/include/eosio/chain/block_header_state.hpp +++ b/libraries/chain/include/eosio/chain/block_header_state.hpp @@ -49,7 +49,7 @@ struct block_header_state { producer_key get_scheduled_producer( block_timestamp_type t )const; const block_id_type& prev()const { return header.previous; } digest_type sig_digest()const; - void sign( const std::function& signer, bool trust = false ); + void sign( const std::function& signer ); public_key_type signee()const; }; From 0ec841b77650e0b0ae43ebbf33b84b4a30fb3dcb Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Tue, 31 Jul 2018 19:25:14 -0400 Subject: [PATCH 09/27] Updating asset and symbol --- contracts/CMakeLists.txt | 2 +- contracts/eosiolib/CMakeLists.txt | 4 ++-- contracts/eosiolib/asset.hpp | 2 +- contracts/eosiolib/core_symbol.hpp | 7 ------- 4 files changed, 4 insertions(+), 11 deletions(-) delete mode 100644 contracts/eosiolib/core_symbol.hpp diff --git a/contracts/CMakeLists.txt b/contracts/CMakeLists.txt index 4b1e235715a..e1517dcd567 100644 --- a/contracts/CMakeLists.txt +++ b/contracts/CMakeLists.txt @@ -2,7 +2,7 @@ # these directories go as -isystem to avoid warnings from code of third-party libraries set(DEFAULT_SYSTEM_INCLUDE_FOLDERS ${CMAKE_SOURCE_DIR}/contracts/libc++/upstream/include ${CMAKE_SOURCE_DIR}/contracts/musl/upstream/include ${Boost_INCLUDE_DIR}) -set(STANDARD_INCLUDE_FOLDERS ${CMAKE_SOURCE_DIR}/contracts ${CMAKE_SOURCE_DIR}/externals/magic_get/include) +set(STANDARD_INCLUDE_FOLDERS ${CMAKE_SOURCE_DIR}/contracts ${CMAKE_BINARY_DIR}/contracts ${CMAKE_SOURCE_DIR}/externals/magic_get/include) add_subdirectory(eosiolib) add_subdirectory(musl) diff --git a/contracts/eosiolib/CMakeLists.txt b/contracts/eosiolib/CMakeLists.txt index 4451c5b5044..f7dc3b0c5a0 100644 --- a/contracts/eosiolib/CMakeLists.txt +++ b/contracts/eosiolib/CMakeLists.txt @@ -1,6 +1,6 @@ -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/core_symbol.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/core_symbol.hpp) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/core_symbol.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/core_symbol.hpp) add_wast_library(TARGET eosiolib INCLUDE_FOLDERS "${STANDARD_INCLUDE_FOLDERS}" ${CMAKE_SOURCE_DIR}/externals/magic_get/include DESTINATION_FOLDER ${CMAKE_CURRENT_BINARY_DIR} -) \ No newline at end of file +) diff --git a/contracts/eosiolib/asset.hpp b/contracts/eosiolib/asset.hpp index 86b45f67b84..ce9db086e65 100644 --- a/contracts/eosiolib/asset.hpp +++ b/contracts/eosiolib/asset.hpp @@ -174,9 +174,9 @@ namespace eosio { */ asset& operator*=( int64_t a ) { eosio_assert( a == 0 || (amount * a) / a == amount, "multiplication overflow or underflow" ); + amount *= a; eosio_assert( -max_amount <= amount, "multiplication underflow" ); eosio_assert( amount <= max_amount, "multiplication overflow" ); - amount *= a; return *this; } diff --git a/contracts/eosiolib/core_symbol.hpp b/contracts/eosiolib/core_symbol.hpp deleted file mode 100644 index b4b86071f70..00000000000 --- a/contracts/eosiolib/core_symbol.hpp +++ /dev/null @@ -1,7 +0,0 @@ -/** @file - * @copyright defined in eos/LICENSE.txt - * - * \warning This file is machine generated. DO NOT EDIT. See core_symbol.hpp.in for changes. - */ - -#define CORE_SYMBOL S(4,SYS) From e711e92864708e7bdc6db912854989b5f8c905eb Mon Sep 17 00:00:00 2001 From: Bart Wyatt Date: Wed, 1 Aug 2018 09:08:59 -0400 Subject: [PATCH 10/27] add duration to output --- libraries/chain/controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 46a1b729039..4fac146f2f1 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -231,7 +231,7 @@ struct controller_impl { std::cerr<< "\n"; ilog( "${n} reversible blocks replayed", ("n",rev) ); auto end = fc::time_point::now(); - ilog( "replayed ${n} blocks in seconds, ${mspb} ms/block", + ilog( "replayed ${n} blocks in ${duration} seconds, ${mspb} ms/block", ("n", head->block_num)("duration", (end-start).count()/1000000) ("mspb", ((end-start).count()/1000.0)/head->block_num) ); std::cerr<< "\n"; From d5ebc2883dbb0b9659639e3e045af795a5d7528e Mon Sep 17 00:00:00 2001 From: arhag Date: Wed, 18 Jul 2018 11:23:11 -0400 Subject: [PATCH 11/27] allow build script to build in arbitrary directories --- eosio_build.sh | 551 +++++++++++++++++----------------- scripts/clean_old_install.sh | 3 + scripts/eosio_build_darwin.sh | 24 +- 3 files changed, 294 insertions(+), 284 deletions(-) diff --git a/eosio_build.sh b/eosio_build.sh index 85da7e88fbb..c908d8e37d5 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -6,19 +6,19 @@ # Copyright (c) 2017, Respective Authors all rights reserved. # # After June 1, 2018 this software is available under the following terms: -# +# # The MIT License -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -30,275 +30,282 @@ # https://github.com/EOSIO/eos/blob/master/LICENSE.txt ########################################################################## - CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - if [ "${CWD}" != "${PWD}" ]; then - printf "\\n\\tPlease cd into directory %s to run this script.\\n \\tExiting now.\\n\\n" "${CWD}" - exit 1 - fi - if [ -f "${PWD}/CMakeCache.txt" ]; then - printf "\\n\\tPlease remove file %s/CMakeCache.txt before building EOSIO.\\n \\tExiting now.\\n\\n" "${PWD}" - exit 1 - fi - - function usage() - { - printf "\\tUsage: %s \\n\\t[Build Option -o ] \\n\\t[CodeCoverage -c ] \\n\\t[Doxygen -d] \\n\\t[CoreSymbolName -s <1-7 characters>]\\n\\n" "$0" 1>&2 - exit 1 - } - - ARCH=$( uname ) - BUILD_DIR="${PWD}/build" - CMAKE_BUILD_TYPE=Release - DISK_MIN=20 - DOXYGEN=false - ENABLE_COVERAGE_TESTING=false - CORE_SYMBOL_NAME="SYS" - TEMP_DIR="/tmp" - TIME_BEGIN=$( date -u +%s ) - VERSION=1.2 - - txtbld=$(tput bold) - bldred=${txtbld}$(tput setaf 1) - txtrst=$(tput sgr0) - - if [ $# -ne 0 ]; then - while getopts ":cdo:s:" opt; do - case "${opt}" in - o ) - options=( "Debug" "Release" "RelWithDebInfo" "MinSizeRel" ) - if [[ "${options[*]}" =~ "${OPTARG}" ]]; then - CMAKE_BUILD_TYPE="${OPTARG}" - else - printf "\\n\\tInvalid argument: %s\\n" "${OPTARG}" 1>&2 - usage - exit 1 - fi - ;; - c ) - ENABLE_COVERAGE_TESTING=true - ;; - d ) - DOXYGEN=true - ;; - s) - if [ "${#OPTARG}" -gt 6 ] || [ -z "${#OPTARG}" ]; then - printf "\\n\\tInvalid argument: %s\\n" "${OPTARG}" 1>&2 - usage - exit 1 - else - CORE_SYMBOL_NAME="${OPTARG}" - fi - ;; - \? ) - printf "\\n\\tInvalid Option: %s\\n" "-${OPTARG}" 1>&2 - usage - exit 1 - ;; - : ) - printf "\\n\\tInvalid Option: %s requires an argument.\\n" "-${OPTARG}" 1>&2 - usage - exit 1 - ;; - * ) - usage - exit 1 - ;; - esac - done - fi - - if [ ! -d .git ]; then - printf "\\n\\tThis build script only works with sources cloned from git\\n" - printf "\\tPlease clone a new eos directory with 'git clone https://github.com/EOSIO/eos --recursive'\\n" - printf "\\tSee the wiki for instructions: https://github.com/EOSIO/eos/wiki\\n" - exit 1 - fi - - STALE_SUBMODS=$(( $(git submodule status | grep -c "^[+\-]") )) - if [ $STALE_SUBMODS -gt 0 ]; then - printf "\\n\\tgit submodules are not up to date.\\n" - printf "\\tPlease run the command 'git submodule update --init --recursive'.\\n" - exit 1 - fi - - printf "\\n\\tBeginning build version: %s\\n" "${VERSION}" - printf "\\t%s\\n" "$( date -u )" - printf "\\tUser: %s\\n" "$( whoami )" - printf "\\tgit head id: %s\\n" "$( cat .git/refs/heads/master )" - printf "\\tCurrent branch: %s\\n" "$( git rev-parse --abbrev-ref HEAD )" - printf "\\n\\tARCHITECTURE: %s\\n" "${ARCH}" - - if [ "$ARCH" == "Linux" ]; then - - if [ ! -e /etc/os-release ]; then - printf "\\n\\tEOSIO currently supports Amazon, Centos, Fedora, Mint & Ubuntu Linux only.\\n" - printf "\\tPlease install on the latest version of one of these Linux distributions.\\n" - printf "\\thttps://aws.amazon.com/amazon-linux-ami/\\n" - printf "\\thttps://www.centos.org/\\n" - printf "\\thttps://start.fedoraproject.org/\\n" - printf "\\thttps://linuxmint.com/\\n" - printf "\\thttps://www.ubuntu.com/\\n" - printf "\\tExiting now.\\n" - exit 1 - fi - - OS_NAME=$( cat /etc/os-release | grep ^NAME | cut -d'=' -f2 | sed 's/\"//gI' ) - - case "$OS_NAME" in - "Amazon Linux AMI") - FILE="${PWD}/scripts/eosio_build_amazon.sh" - CXX_COMPILER=g++ - C_COMPILER=gcc - MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf - export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm - export CMAKE=${HOME}/opt/cmake/bin/cmake - export PATH=${HOME}/opt/mongodb/bin:$PATH - ;; - "CentOS Linux") - FILE="${PWD}/scripts/eosio_build_centos.sh" - CXX_COMPILER=g++ - C_COMPILER=gcc - MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf - export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm - export CMAKE=${HOME}/opt/cmake/bin/cmake - export PATH=${HOME}/opt/mongodb/bin:$PATH - ;; - "elementary OS") - FILE="${PWD}/scripts/eosio_build_ubuntu.sh" - CXX_COMPILER=clang++-4.0 - C_COMPILER=clang-4.0 - MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf - export PATH=${HOME}/opt/mongodb/bin:$PATH - ;; - "Fedora") - FILE="${PWD}/scripts/eosio_build_fedora.sh" - CXX_COMPILER=g++ - C_COMPILER=gcc - MONGOD_CONF=/etc/mongod.conf - export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm - ;; - "Linux Mint") - FILE="${PWD}/scripts/eosio_build_ubuntu.sh" - CXX_COMPILER=clang++-4.0 - C_COMPILER=clang-4.0 - MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf - export PATH=${HOME}/opt/mongodb/bin:$PATH - ;; - "Ubuntu") - FILE="${PWD}/scripts/eosio_build_ubuntu.sh" - CXX_COMPILER=clang++-4.0 - C_COMPILER=clang-4.0 - MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf - export PATH=${HOME}/opt/mongodb/bin:$PATH - ;; - "Debian GNU/Linux") - FILE=${PWD}/scripts/eosio_build_ubuntu.sh - CXX_COMPILER=clang++-4.0 - C_COMPILER=clang-4.0 - MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf - export PATH=${HOME}/opt/mongodb/bin:$PATH - ;; - *) - printf "\\n\\tUnsupported Linux Distribution. Exiting now.\\n\\n" - exit 1 - esac - - export BOOST_ROOT="${HOME}/opt/boost" - OPENSSL_ROOT_DIR=/usr/include/openssl - fi - - if [ "$ARCH" == "Darwin" ]; then - FILE="${PWD}/scripts/eosio_build_darwin.sh" - CXX_COMPILER=clang++ - C_COMPILER=clang - MONGOD_CONF=/usr/local/etc/mongod.conf - OPENSSL_ROOT_DIR=/usr/local/opt/openssl - fi - - ${PWD}/scripts/clean_old_install.sh + SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + + function usage() + { + printf "\\tUsage: %s \\n\\t[Build Option -o ] \\n\\t[CodeCoverage -c] \\n\\t[Doxygen -d] \\n\\t[CoreSymbolName -s <1-7 characters>] \\n\\t[Avoid Compiling -a]\\n\\n" "$0" 1>&2 + exit 1 + } + + ARCH=$( uname ) + if [ "${SOURCE_DIR}" == "${PWD}" ]; then + BUILD_DIR="${PWD}/build" + else + BUILD_DIR="${PWD}" + fi + CMAKE_BUILD_TYPE=Release + DISK_MIN=20 + DOXYGEN=false + ENABLE_COVERAGE_TESTING=false + CORE_SYMBOL_NAME="SYS" + START_MAKE=true + TEMP_DIR="/tmp" + TIME_BEGIN=$( date -u +%s ) + VERSION=1.2 + + txtbld=$(tput bold) + bldred=${txtbld}$(tput setaf 1) + txtrst=$(tput sgr0) + + if [ $# -ne 0 ]; then + while getopts ":cdo:s:ah" opt; do + case "${opt}" in + o ) + options=( "Debug" "Release" "RelWithDebInfo" "MinSizeRel" ) + if [[ "${options[*]}" =~ "${OPTARG}" ]]; then + CMAKE_BUILD_TYPE="${OPTARG}" + else + printf "\\n\\tInvalid argument: %s\\n" "${OPTARG}" 1>&2 + usage + exit 1 + fi + ;; + c ) + ENABLE_COVERAGE_TESTING=true + ;; + d ) + DOXYGEN=true + ;; + s) + if [ "${#OPTARG}" -gt 6 ] || [ -z "${#OPTARG}" ]; then + printf "\\n\\tInvalid argument: %s\\n" "${OPTARG}" 1>&2 + usage + exit 1 + else + CORE_SYMBOL_NAME="${OPTARG}" + fi + ;; + a) + START_MAKE=false + ;; + h) + usage + exit 1 + ;; + \? ) + printf "\\n\\tInvalid Option: %s\\n" "-${OPTARG}" 1>&2 + usage + exit 1 + ;; + : ) + printf "\\n\\tInvalid Option: %s requires an argument.\\n" "-${OPTARG}" 1>&2 + usage + exit 1 + ;; + * ) + usage + exit 1 + ;; + esac + done + fi + + if [ ! -d "${SOURCE_DIR}/.git" ]; then + printf "\\n\\tThis build script only works with sources cloned from git\\n" + printf "\\tPlease clone a new eos directory with 'git clone https://github.com/EOSIO/eos --recursive'\\n" + printf "\\tSee the wiki for instructions: https://github.com/EOSIO/eos/wiki\\n" + exit 1 + fi + + pushd "${SOURCE_DIR}" &> /dev/null + + STALE_SUBMODS=$(( $(git submodule status | grep -c "^[+\-]") )) + if [ $STALE_SUBMODS -gt 0 ]; then + printf "\\n\\tgit submodules are not up to date.\\n" + printf "\\tPlease run the command 'git submodule update --init --recursive'.\\n" + exit 1 + fi + + printf "\\n\\tBeginning build version: %s\\n" "${VERSION}" + printf "\\t%s\\n" "$( date -u )" + printf "\\tUser: %s\\n" "$( whoami )" + printf "\\tgit head id: %s\\n" "$( cat .git/refs/heads/master )" + printf "\\tCurrent branch: %s\\n" "$( git rev-parse --abbrev-ref HEAD )" + printf "\\n\\tARCHITECTURE: %s\\n" "${ARCH}" + + popd &> /dev/null + + if [ "$ARCH" == "Linux" ]; then + + if [ ! -e /etc/os-release ]; then + printf "\\n\\tEOSIO currently supports Amazon, Centos, Fedora, Mint & Ubuntu Linux only.\\n" + printf "\\tPlease install on the latest version of one of these Linux distributions.\\n" + printf "\\thttps://aws.amazon.com/amazon-linux-ami/\\n" + printf "\\thttps://www.centos.org/\\n" + printf "\\thttps://start.fedoraproject.org/\\n" + printf "\\thttps://linuxmint.com/\\n" + printf "\\thttps://www.ubuntu.com/\\n" + printf "\\tExiting now.\\n" + exit 1 + fi + + OS_NAME=$( cat /etc/os-release | grep ^NAME | cut -d'=' -f2 | sed 's/\"//gI' ) + + case "$OS_NAME" in + "Amazon Linux AMI") + FILE="${SOURCE_DIR}/scripts/eosio_build_amazon.sh" + CXX_COMPILER=g++ + C_COMPILER=gcc + MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf + export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm + export CMAKE=${HOME}/opt/cmake/bin/cmake + export PATH=${HOME}/opt/mongodb/bin:$PATH + ;; + "CentOS Linux") + FILE="${SOURCE_DIR}/scripts/eosio_build_centos.sh" + CXX_COMPILER=g++ + C_COMPILER=gcc + MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf + export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm + export CMAKE=${HOME}/opt/cmake/bin/cmake + export PATH=${HOME}/opt/mongodb/bin:$PATH + ;; + "elementary OS") + FILE="${SOURCE_DIR}/scripts/eosio_build_ubuntu.sh" + CXX_COMPILER=clang++-4.0 + C_COMPILER=clang-4.0 + MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf + export PATH=${HOME}/opt/mongodb/bin:$PATH + ;; + "Fedora") + FILE="${SOURCE_DIR}/scripts/eosio_build_fedora.sh" + CXX_COMPILER=g++ + C_COMPILER=gcc + MONGOD_CONF=/etc/mongod.conf + export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm + ;; + "Linux Mint") + FILE="${SOURCE_DIR}/scripts/eosio_build_ubuntu.sh" + CXX_COMPILER=clang++-4.0 + C_COMPILER=clang-4.0 + MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf + export PATH=${HOME}/opt/mongodb/bin:$PATH + ;; + "Ubuntu") + FILE="${SOURCE_DIR}/scripts/eosio_build_ubuntu.sh" + CXX_COMPILER=clang++-4.0 + C_COMPILER=clang-4.0 + MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf + export PATH=${HOME}/opt/mongodb/bin:$PATH + ;; + "Debian GNU/Linux") + FILE=${SOURCE_DIR}/scripts/eosio_build_ubuntu.sh + CXX_COMPILER=clang++-4.0 + C_COMPILER=clang-4.0 + MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf + export PATH=${HOME}/opt/mongodb/bin:$PATH + ;; + *) + printf "\\n\\tUnsupported Linux Distribution. Exiting now.\\n\\n" + exit 1 + esac + + export BOOST_ROOT="${HOME}/opt/boost" + OPENSSL_ROOT_DIR=/usr/include/openssl + fi + + if [ "$ARCH" == "Darwin" ]; then + FILE="${SOURCE_DIR}/scripts/eosio_build_darwin.sh" + CXX_COMPILER=clang++ + C_COMPILER=clang + MONGOD_CONF=/usr/local/etc/mongod.conf + OPENSSL_ROOT_DIR=/usr/local/opt/openssl + fi + + ${SOURCE_DIR}/scripts/clean_old_install.sh if [ $? -ne 0 ]; then - printf "\n\tError occurred while trying to remove old installation!\n\n" + printf "\\n\\tError occurred while trying to remove old installation!\\n\\n" exit -1 fi - . "$FILE" - - printf "\\n\\n>>>>>>>> ALL dependencies sucessfully found or installed . Installing EOSIO\\n\\n" - printf ">>>>>>>> CMAKE_BUILD_TYPE=%s\\n" "${CMAKE_BUILD_TYPE}" - printf ">>>>>>>> ENABLE_COVERAGE_TESTING=%s\\n" "${ENABLE_COVERAGE_TESTING}" - printf ">>>>>>>> DOXYGEN=%s\\n\\n" "${DOXYGEN}" - - if [ ! -d "${BUILD_DIR}" ]; then - if ! mkdir -p "${BUILD_DIR}" - then - printf "Unable to create build directory %s.\\n Exiting now.\\n" "${BUILD_DIR}" - exit 1; - fi - fi - - if ! cd "${BUILD_DIR}" - then - printf "Unable to enter build directory %s.\\n Exiting now.\\n" "${BUILD_DIR}" - exit 1; - fi - - if [ -z "$CMAKE" ]; then - CMAKE=$( command -v cmake ) - fi - - if ! "${CMAKE}" -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" -DCMAKE_CXX_COMPILER="${CXX_COMPILER}" \ - -DCMAKE_C_COMPILER="${C_COMPILER}" -DWASM_ROOT="${WASM_ROOT}" -DCORE_SYMBOL_NAME="${CORE_SYMBOL_NAME}" \ - -DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" -DBUILD_MONGO_DB_PLUGIN=true \ - -DENABLE_COVERAGE_TESTING="${ENABLE_COVERAGE_TESTING}" -DBUILD_DOXYGEN="${DOXYGEN}" -DCMAKE_INSTALL_PREFIX="/usr/local/eosio" .. - then - printf "\\n\\t>>>>>>>>>>>>>>>>>>>> CMAKE building EOSIO has exited with the above error.\\n\\n" - exit -1 - fi - - if ! make -j"${CPU_CORE}" - then - printf "\\n\\t>>>>>>>>>>>>>>>>>>>> MAKE building EOSIO has exited with the above error.\\n\\n" - exit -1 - fi - - TIME_END=$(( $(date -u +%s) - ${TIME_BEGIN} )) - - printf "\n\n${bldred}\t _______ _______ _______ _________ _______\n" - printf '\t( ____ \( ___ )( ____ \\\\__ __/( ___ )\n' - printf "\t| ( \/| ( ) || ( \/ ) ( | ( ) |\n" - printf "\t| (__ | | | || (_____ | | | | | |\n" - printf "\t| __) | | | |(_____ ) | | | | | |\n" - printf "\t| ( | | | | ) | | | | | | |\n" - printf "\t| (____/\| (___) |/\____) |___) (___| (___) |\n" - printf "\t(_______/(_______)\_______)\_______/(_______)\n${txtrst}" - - printf "\\n\\tEOSIO has been successfully built. %02d:%02d:%02d\\n\\n" $(($TIME_END/3600)) $(($TIME_END%3600/60)) $(($TIME_END%60)) - printf "\\tTo verify your installation run the following commands:\\n" - - print_instructions - - printf "\\tFor more information:\\n" - printf "\\tEOSIO website: https://eos.io\\n" - printf "\\tEOSIO Telegram channel @ https://t.me/EOSProject\\n" - printf "\\tEOSIO resources: https://eos.io/resources/\\n" - printf "\\tEOSIO Stack Exchange: https://eosio.stackexchange.com\\n" - printf "\\tEOSIO wiki: https://github.com/EOSIO/eos/wiki\\n\\n\\n" - - if [ "x${EOSIO_BUILD_PACKAGE}" != "x" ]; then - # Build eos.io package - if ! "$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}" -DCMAKE_INSTALL_PREFIX="/usr" .. - then - printf "\\n\\t>>>>>>>>>>>>>>>>>>>> CMAKE building eos.io package has exited with the above error.\\n\\n" - exit -1 - fi - - if ! make -j${CPU_CORE} VERBOSE=0 package - 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 + . "$FILE" + + printf "\\n\\n>>>>>>>> ALL dependencies sucessfully found or installed . Installing EOSIO\\n\\n" + printf ">>>>>>>> CMAKE_BUILD_TYPE=%s\\n" "${CMAKE_BUILD_TYPE}" + printf ">>>>>>>> ENABLE_COVERAGE_TESTING=%s\\n" "${ENABLE_COVERAGE_TESTING}" + printf ">>>>>>>> DOXYGEN=%s\\n\\n" "${DOXYGEN}" + + if [ ! -d "${BUILD_DIR}" ]; then + if ! mkdir -p "${BUILD_DIR}" + then + printf "Unable to create build directory %s.\\n Exiting now.\\n" "${BUILD_DIR}" + exit 1; + fi + fi + + if ! cd "${BUILD_DIR}" + then + printf "Unable to enter build directory %s.\\n Exiting now.\\n" "${BUILD_DIR}" + exit 1; + fi + + if [ -z "$CMAKE" ]; then + CMAKE=$( command -v cmake ) + fi + + if ! "${CMAKE}" -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" -DCMAKE_CXX_COMPILER="${CXX_COMPILER}" \ + -DCMAKE_C_COMPILER="${C_COMPILER}" -DWASM_ROOT="${WASM_ROOT}" -DCORE_SYMBOL_NAME="${CORE_SYMBOL_NAME}" \ + -DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" -DBUILD_MONGO_DB_PLUGIN=true \ + -DENABLE_COVERAGE_TESTING="${ENABLE_COVERAGE_TESTING}" -DBUILD_DOXYGEN="${DOXYGEN}" \ + -DCMAKE_INSTALL_PREFIX="/usr/local/eosio" "${SOURCE_DIR}" + then + printf "\\n\\t>>>>>>>>>>>>>>>>>>>> CMAKE building EOSIO has exited with the above error.\\n\\n" + exit -1 + fi + + if [ "${START_MAKE}" == "false" ]; then + printf "\\n\\t>>>>>>>>>>>>>>>>>>>> EOSIO has been successfully configured but not yet built.\\n\\n" + exit 0 + fi + + if ! make -j"${CPU_CORE}" + then + printf "\\n\\t>>>>>>>>>>>>>>>>>>>> MAKE building EOSIO has exited with the above error.\\n\\n" + exit -1 + fi + + TIME_END=$(( $(date -u +%s) - ${TIME_BEGIN} )) + + printf "\n\n${bldred}\t _______ _______ _______ _________ _______\n" + printf '\t( ____ \( ___ )( ____ \\\\__ __/( ___ )\n' + printf "\t| ( \/| ( ) || ( \/ ) ( | ( ) |\n" + printf "\t| (__ | | | || (_____ | | | | | |\n" + printf "\t| __) | | | |(_____ ) | | | | | |\n" + printf "\t| ( | | | | ) | | | | | | |\n" + printf "\t| (____/\| (___) |/\____) |___) (___| (___) |\n" + printf "\t(_______/(_______)\_______)\_______/(_______)\n${txtrst}" + + printf "\\n\\tEOSIO has been successfully built. %02d:%02d:%02d\\n\\n" $(($TIME_END/3600)) $(($TIME_END%3600/60)) $(($TIME_END%60)) + printf "\\tTo verify your installation run the following commands:\\n" + + print_instructions + + printf "\\tFor more information:\\n" + printf "\\tEOSIO website: https://eos.io\\n" + printf "\\tEOSIO Telegram channel @ https://t.me/EOSProject\\n" + printf "\\tEOSIO resources: https://eos.io/resources/\\n" + printf "\\tEOSIO Stack Exchange: https://eosio.stackexchange.com\\n" + printf "\\tEOSIO wiki: https://github.com/EOSIO/eos/wiki\\n\\n\\n" + + if [ "x${EOSIO_BUILD_PACKAGE}" != "x" ]; then + # Build EOSIO package + + if ! make -j${CPU_CORE} VERBOSE=0 package + then + printf "\\n\\t>>>>>>>>>>>>>>>>>>>> MAKE building EOSIO package has exited with the above error.\\n\\n" + exit -1 + fi + + printf "\\n\\t>>>>>>>>>>>>>>>>>>>> EOSIO package has been successfully built.\\n\\n" + fi diff --git a/scripts/clean_old_install.sh b/scripts/clean_old_install.sh index 44306068df1..03315ff744b 100755 --- a/scripts/clean_old_install.sh +++ b/scripts/clean_old_install.sh @@ -11,6 +11,7 @@ if [ -d "/usr/local/include/eosio" ]; then exit -1 fi pushd /usr/local &> /dev/null + pushd include &> /dev/null rm -rf appbase chainbase eosio eosio.system eosiolib fc libc++ musl &> /dev/null popd &> /dev/null @@ -57,6 +58,8 @@ if [ -d "/usr/local/include/eosio" ]; then pushd var/log &> /dev/null rm eosio &> /dev/null + popd &> /dev/null + popd &> /dev/null break;; [Nn]* ) diff --git a/scripts/eosio_build_darwin.sh b/scripts/eosio_build_darwin.sh index 166671cf526..63c500ecc87 100644 --- a/scripts/eosio_build_darwin.sh +++ b/scripts/eosio_build_darwin.sh @@ -72,7 +72,7 @@ printf "\\tDo you wish to install Home Brew?\\n" select yn in "Yes" "No"; do case "${yn}" in - [Yy]* ) + [Yy]* ) "${XCODESELECT}" --install 2>/dev/null; if ! "${RUBY}" -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" then @@ -91,7 +91,7 @@ printf "\\tHome Brew installation found @\\n" printf "\\t%s\\n\\n" "${BREW}" - + COUNT=1 PERMISSION_GETTEXT=0 DISPLAY="" @@ -121,9 +121,9 @@ DISPLAY="${DISPLAY}${COUNT}. ${name}\\n\\t" printf "\\t\\t %s ${bldred}NOT${txtrst} found.\\n" "${name}" (( COUNT++ )) - done < scripts/eosio_build_dep + done < "${SOURCE_DIR}/scripts/eosio_build_dep" IFS="${var_ifs}" - + printf "\\tChecking Python3 ... " if [ -z "$( python3 -c 'import sys; print(sys.version_info.major)' 2>/dev/null )" ]; then DEP=$DEP"python@3 " @@ -140,7 +140,7 @@ echo "Do you wish to install these packages?" select yn in "Yes" "No"; do case $yn in - [Yy]* ) + [Yy]* ) if [ $PERMISSION_GETTEXT -eq 1 ]; then sudo chown -R "$(whoami)" /usr/local/share fi @@ -170,11 +170,11 @@ * ) echo "Please type 1 for yes or 2 for no.";; esac done - else + else printf "\\n\\tNo required Home Brew dependencies to install.\\n" fi - + printf "\\n\\tChecking boost library installation.\\n" BVERSION=$( grep "#define BOOST_VERSION" "/usr/local/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) if [ "${BVERSION}" != "106700" ]; then @@ -186,7 +186,7 @@ case $yn in [Yy]* ) if "${BREW}" list | grep "boost" - then + then printf "\\tUninstalling Boost Version %s.\\n" "${BVERSION}" if ! "${BREW}" uninstall --force boost then @@ -237,7 +237,7 @@ printf "\\n\\tChecking MongoDB C++ driver installation.\\n" MONGO_INSTALL=true - + if [ -e "/usr/local/lib/libmongocxx-static.a" ]; then MONGO_INSTALL=false if ! version=$( grep "Version:" /usr/local/lib/pkgconfig/libmongocxx-static.pc | tr -s ' ' | awk '{print $2}' ) @@ -246,7 +246,7 @@ printf "\\tExiting now.\\n\\n" exit 1; fi - + maj=$( echo "${version}" | cut -d'.' -f1 ) min=$( echo "${version}" | cut -d'.' -f2 ) if [ "${maj}" -gt 3 ]; then @@ -451,7 +451,7 @@ else printf "\\tsecp256k1 found at /usr/local/lib/.\\n" fi - + printf "\\n\\tChecking LLVM with WASM support.\\n" if [ ! -d /usr/local/wasm/bin ]; then if ! cd "${TEMP_DIR}" @@ -538,4 +538,4 @@ printf "\\n\\t%s -f %s &\\n" "$( command -v mongod )" "${MONGOD_CONF}" printf "\\tcd %s; make test\\n\\n" "${BUILD_DIR}" return 0 - } \ No newline at end of file + } From 7743cac303c013466fc24eb58e462095a1499cbb Mon Sep 17 00:00:00 2001 From: arhag Date: Wed, 1 Aug 2018 11:44:29 -0400 Subject: [PATCH 12/27] remove unneeded package creation step from build script --- eosio_build.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/eosio_build.sh b/eosio_build.sh index c908d8e37d5..d4ef3b01b6c 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -297,15 +297,3 @@ printf "\\tEOSIO resources: https://eos.io/resources/\\n" printf "\\tEOSIO Stack Exchange: https://eosio.stackexchange.com\\n" printf "\\tEOSIO wiki: https://github.com/EOSIO/eos/wiki\\n\\n\\n" - - if [ "x${EOSIO_BUILD_PACKAGE}" != "x" ]; then - # Build EOSIO package - - if ! make -j${CPU_CORE} VERBOSE=0 package - then - printf "\\n\\t>>>>>>>>>>>>>>>>>>>> MAKE building EOSIO package has exited with the above error.\\n\\n" - exit -1 - fi - - printf "\\n\\t>>>>>>>>>>>>>>>>>>>> EOSIO package has been successfully built.\\n\\n" - fi From e63d3e76b97444b0fa1cc8df848c0c5be3b9b91b Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 1 Aug 2018 11:46:40 -0400 Subject: [PATCH 13/27] Renamed LICENSE.txt to LICENSE --- LICENSE.txt => LICENSE | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename LICENSE.txt => LICENSE (100%) diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE From 0b9cd2ffbc46ae81daea353379a5bfaf909e2089 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 1 Aug 2018 11:54:42 -0400 Subject: [PATCH 14/27] Added safeguard for installing to /usr/local --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a10fdfcb3be..dfd53a68c80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,13 @@ project( EOSIO ) enable_testing() +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + message(WARNING "CMAKE_INSTALL_PREFIX is set to default path of ${CMAKE_INSTALL_PREFIX}, resetting to ${CMAKE_INSTALL_PREFIX}/eosio") + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/eosio") +elseif ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local") + message(WARNING "CMAKE_INSTALL_PREFIX is explicitly set to /usr/local. This is not recommended.") +endif() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") From 67393d7e1a100d1ccc982ec1563c7e687378cca6 Mon Sep 17 00:00:00 2001 From: arhag Date: Wed, 1 Aug 2018 11:59:43 -0400 Subject: [PATCH 15/27] do not install files made obsolete by eosio.wasmsdk --- CMakeModules/wasm.cmake | 10 ++++------ contracts/CMakeLists.txt | 7 ------- externals/CMakeLists.txt | 1 - 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CMakeModules/wasm.cmake b/CMakeModules/wasm.cmake index 50e833c12e9..a8475728e49 100644 --- a/CMakeModules/wasm.cmake +++ b/CMakeModules/wasm.cmake @@ -22,7 +22,7 @@ macro(compile_wast) endif() set(outfiles "") foreach(srcfile ${SOURCE_FILES}) - + get_filename_component(outfile ${srcfile} NAME) get_filename_component(extension ${srcfile} EXT) get_filename_component(infile ${srcfile} ABSOLUTE) @@ -107,8 +107,6 @@ macro(add_wast_library) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM ) - #TODO: Fix this path on pending cmake install changes - install(FILES ${${ARG_TARGET}_BC_FILENAME} DESTINATION usr/share/eosio/contractsdk/lib) endmacro(add_wast_library) @@ -173,7 +171,7 @@ macro(add_wast_executable) COMMENT "Generating ${target}.wast.hpp" VERBATIM ) - + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${target}.abi ) add_custom_command(OUTPUT ${DESTINATION_FOLDER}/${target}.abi.hpp DEPENDS ${DESTINATION_FOLDER}/${target}.abi @@ -187,9 +185,9 @@ macro(add_wast_executable) set(extra_target_dependency ${DESTINATION_FOLDER}/${target}.abi.hpp) else() endif() - + add_custom_target(${target} ALL DEPENDS ${DESTINATION_FOLDER}/${target}.wast.hpp ${extra_target_dependency} ${DESTINATION_FOLDER}/${target}.wasm) - + set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${DESTINATION_FOLDER}/${target}.wast.hpp) set_property(TARGET ${target} PROPERTY INCLUDE_DIRECTORIES ${ARG_INCLUDE_FOLDERS}) diff --git a/contracts/CMakeLists.txt b/contracts/CMakeLists.txt index e1517dcd567..bf9a5c2d30e 100644 --- a/contracts/CMakeLists.txt +++ b/contracts/CMakeLists.txt @@ -47,10 +47,3 @@ add_custom_command(OUTPUT share/eosio/skeleton/skeleton.cpp 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 eosio.system 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/externals/CMakeLists.txt b/externals/CMakeLists.txt index 536c85e936d..4fac3528746 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -1,2 +1 @@ add_subdirectory( binaryen ) -install(DIRECTORY magic_get/include/boost DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) From 6cd7197b99fddbc58bba505e4a5ac247db4a22e8 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 1 Aug 2018 13:08:44 -0400 Subject: [PATCH 16/27] add include path of core_symbol.hpp for abi_tests --- unittests/abi_tests.cpp | 3 ++- unittests/include/config.hpp.in | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/unittests/abi_tests.cpp b/unittests/abi_tests.cpp index 87fa6e16b8c..17afef2d1c3 100644 --- a/unittests/abi_tests.cpp +++ b/unittests/abi_tests.cpp @@ -529,6 +529,7 @@ struct abi_gen_helper { bool generate_abi(const char* source, const char* abi, bool opt_sfs=false) { std::string include_param = std::string("-I") + eosiolib_path; + std::string core_sym_include_param = std::string("-I") + core_symbol_path; std::string pfr_include_param = std::string("-I") + pfr_include_path; std::string boost_include_param = std::string("-I") + boost_include_path; std::string stdcpp_include_param = std::string("-I") + eosiolib_path + "/libc++/upstream/include"; @@ -542,7 +543,7 @@ struct abi_gen_helper { auto extra_args = std::vector{"-fparse-all-comments", "--std=c++14", "--target=wasm32", "-ffreestanding", "-nostdlib", "-nostdlibinc", "-fno-threadsafe-statics", "-fno-rtti", "-fno-exceptions", include_param, boost_include_param, stdcpp_include_param, - stdc_include_param, pfr_include_param }; + stdc_include_param, pfr_include_param, core_sym_include_param }; bool res = runToolOnCodeWithArgs( new find_eosio_abi_macro_action(contract, actions, ""), diff --git a/unittests/include/config.hpp.in b/unittests/include/config.hpp.in index 1ece71657cc..cd6dd6435e8 100644 --- a/unittests/include/config.hpp.in +++ b/unittests/include/config.hpp.in @@ -5,6 +5,7 @@ namespace eosio { namespace unittests { namespace config { constexpr char eosiolib_path[] = "${CMAKE_CURRENT_SOURCE_DIR}/../contracts"; + constexpr char core_symbol_path[] = "${CMAKE_BINARY_DIR}/contracts"; constexpr char pfr_include_path[] = "${CMAKE_CURRENT_SOURCE_DIR}/../externals/magic_get/include"; constexpr char boost_include_path[] = "${Boost_INCLUDE_DIR}"; }}} From 67bada0f7a90c33cc808347541bba3c9cdb3180d Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 1 Aug 2018 13:24:49 -0400 Subject: [PATCH 17/27] updated references to LICENSE.txt --- CMakeModules/installer.cmake | 2 +- eosio_build.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeModules/installer.cmake b/CMakeModules/installer.cmake index 797fd2606f5..e4ca2b7e01f 100644 --- a/CMakeModules/installer.cmake +++ b/CMakeModules/installer.cmake @@ -17,7 +17,7 @@ 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 "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_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_INSTALL_DIRECTORY "EOS.IO ${CPACK_PACKAGE_VERSION}") if(WIN32) diff --git a/eosio_build.sh b/eosio_build.sh index 85da7e88fbb..719a3f513c7 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -27,7 +27,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -# https://github.com/EOSIO/eos/blob/master/LICENSE.txt +# https://github.com/EOSIO/eos/blob/master/LICENSE ########################################################################## CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -52,7 +52,7 @@ DISK_MIN=20 DOXYGEN=false ENABLE_COVERAGE_TESTING=false - CORE_SYMBOL_NAME="SYS" + CORE_SYMBOL_NAME="EOS" TEMP_DIR="/tmp" TIME_BEGIN=$( date -u +%s ) VERSION=1.2 From c233c4f53b126d218d57d730a8058986b77be272 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 1 Aug 2018 13:31:56 -0400 Subject: [PATCH 18/27] Reverted changes --- CMakeModules/installer.cmake | 2 +- eosio_build.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeModules/installer.cmake b/CMakeModules/installer.cmake index e4ca2b7e01f..797fd2606f5 100644 --- a/CMakeModules/installer.cmake +++ b/CMakeModules/installer.cmake @@ -17,7 +17,7 @@ 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 "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") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") set(CPACK_PACKAGE_INSTALL_DIRECTORY "EOS.IO ${CPACK_PACKAGE_VERSION}") if(WIN32) diff --git a/eosio_build.sh b/eosio_build.sh index 719a3f513c7..85da7e88fbb 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -27,7 +27,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -# https://github.com/EOSIO/eos/blob/master/LICENSE +# https://github.com/EOSIO/eos/blob/master/LICENSE.txt ########################################################################## CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -52,7 +52,7 @@ DISK_MIN=20 DOXYGEN=false ENABLE_COVERAGE_TESTING=false - CORE_SYMBOL_NAME="EOS" + CORE_SYMBOL_NAME="SYS" TEMP_DIR="/tmp" TIME_BEGIN=$( date -u +%s ) VERSION=1.2 From 53d0db4bf98dde6314f21842a683c8a89a012458 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 1 Aug 2018 13:34:12 -0400 Subject: [PATCH 19/27] Updated eosio_build.sh and installer.cmake to reference new LICENSE --- CMakeModules/installer.cmake | 2 +- eosio_build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeModules/installer.cmake b/CMakeModules/installer.cmake index 797fd2606f5..e4ca2b7e01f 100644 --- a/CMakeModules/installer.cmake +++ b/CMakeModules/installer.cmake @@ -17,7 +17,7 @@ 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 "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_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_INSTALL_DIRECTORY "EOS.IO ${CPACK_PACKAGE_VERSION}") if(WIN32) diff --git a/eosio_build.sh b/eosio_build.sh index 85da7e88fbb..b990b11bbfa 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -27,7 +27,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -# https://github.com/EOSIO/eos/blob/master/LICENSE.txt +# https://github.com/EOSIO/eos/blob/master/LICENSE ########################################################################## CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" From 43c85294ffc45a5ba59c6ff8c986c6961de3a2d9 Mon Sep 17 00:00:00 2001 From: arhag Date: Wed, 1 Aug 2018 14:35:48 -0400 Subject: [PATCH 20/27] fix CMake dependecy on chain/webassembly header files; change install location of wasm-jit header files --- libraries/chain/CMakeLists.txt | 11 ++++++----- libraries/wasm-jit/CMakeLists.txt | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index 1079e8c4d67..c672f7d5f4a 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -2,7 +2,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/core_symbol.hpp.i configure_file(${CMAKE_CURRENT_SOURCE_DIR}/genesis_state_root_key.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/genesis_state_root_key.cpp) file(GLOB HEADERS "include/eosio/chain/*.hpp" - "include/eosio/chain/contracts/*.hpp" + "include/eosio/chain/webassembly/*.hpp" "${CMAKE_CURRENT_BINARY_DIR}/include/eosio/chain/core_symbol.hpp" ) ## SORT .cpp by most likely to change / break compile @@ -58,14 +58,15 @@ target_include_directories( eosio_chain "${CMAKE_CURRENT_SOURCE_DIR}/../../externals/binaryen/src" ) -set_target_properties( eosio_chain PROPERTIES PUBLIC_HEADER "${HEADERS}" ) -install( TARGETS eosio_chain +install( TARGETS eosio_chain RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/chain ) -install_directory_permissions( DIRECTORY ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/chain ) +install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/ + DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/chain + FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" PATTERN "webassembly" EXCLUDE +) #if(MSVC) # set_source_files_properties( db_init.cpp db_block.cpp database.cpp block_log.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) #endif(MSVC) diff --git a/libraries/wasm-jit/CMakeLists.txt b/libraries/wasm-jit/CMakeLists.txt index 826f90914a9..c06e45b5252 100644 --- a/libraries/wasm-jit/CMakeLists.txt +++ b/libraries/wasm-jit/CMakeLists.txt @@ -21,7 +21,7 @@ include_directories(${WAVM_INCLUDE_DIR}) # Disable RTTI #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") - + # Ensure that even static libraries are relocatable so they can be linked into a .so # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") @@ -76,4 +76,4 @@ add_subdirectory(Source/WASM) add_subdirectory(Source/WAST) #add_subdirectory(Test/spec) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Include DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/wasm-jit/) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Include/ DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/wasm-jit) From b3ae5d438be5546c3f376330544bb59a72be4b74 Mon Sep 17 00:00:00 2001 From: arhag Date: Wed, 1 Aug 2018 14:43:42 -0400 Subject: [PATCH 21/27] update softfloat submodule to incorporate new install location of softfloat headers --- libraries/softfloat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/softfloat b/libraries/softfloat index 23ec8abd95e..9942875eb70 160000 --- a/libraries/softfloat +++ b/libraries/softfloat @@ -1 +1 @@ -Subproject commit 23ec8abd95eb0fb6c73d4c4c0315794187b74e6a +Subproject commit 9942875eb704369db297eb289aa4e9912bddcfb8 From d2699c0c47269c424b22191dc03d10e0d862d980 Mon Sep 17 00:00:00 2001 From: Bart Wyatt Date: Wed, 1 Aug 2018 14:54:09 -0400 Subject: [PATCH 22/27] fix issues with bad blocks getting into reversible --- libraries/chain/controller.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 4fac146f2f1..cbd50207a87 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -878,15 +878,20 @@ struct controller_impl { finalize_block(); + // this implicitly asserts that all header fields (less the signature) are identical + EOS_ASSERT(b->id() == pending->_pending_block_state->header.id(), + block_validate_exception, "Block ID does not match", + ("producer_block_id",b->id())("validator_block_id",pending->_pending_block_state->header.id())); + + // We need to fill out the pending block state's block because that gets serialized in the reversible block log + // in the future we can optimize this by serializing the original and not the copy + // we can always trust this signature because, // - prior to apply_block, we call fork_db.add which does a signature check IFF the block is untrusted // - OTHERWISE the block is trusted and therefore we trust that the signature is valid // Also, as ::sign_block does not lazily calculate the digest of the block, we can just short-circuit to save cycles pending->_pending_block_state->header.producer_signature = b->producer_signature; - - // this is implied by the signature passing - //FC_ASSERT( b->id() == pending->_pending_block_state->block->id(), - // "applying block didn't produce expected block id" ); + static_cast(*pending->_pending_block_state->block) = pending->_pending_block_state->header; commit_block(false); return; From ab724fd38d6b5b096220fef2d9c0cfaf6227e8ae Mon Sep 17 00:00:00 2001 From: arhag Date: Wed, 1 Aug 2018 15:15:27 -0400 Subject: [PATCH 23/27] additional fixes to CMake installation of eosio --- CMakeModules/EosioTester.cmake.in | 44 ++++++++++++-------------- CMakeModules/EosioTesterBuild.cmake.in | 43 ++++++++++++------------- libraries/chain/CMakeLists.txt | 1 + 3 files changed, 42 insertions(+), 46 deletions(-) diff --git a/CMakeModules/EosioTester.cmake.in b/CMakeModules/EosioTester.cmake.in index 2bc75c05369..0827b00d700 100644 --- a/CMakeModules/EosioTester.cmake.in +++ b/CMakeModules/EosioTester.cmake.in @@ -63,24 +63,24 @@ find_library(libsecp256k1 secp256k1 @Secp256k1_ROOT_DIR@/lib) macro(add_eosio_test test_name) add_executable( ${test_name} ${ARGN} ) - target_link_libraries( ${test_name} - ${LLVM} - ${libtester} - ${libchain} - ${libfc} - ${libbinaryen} - ${libwast} - ${libwasm} - ${libruntime} - ${libplatform} - ${libir} - ${libsoftfloat} - ${liboscrypto} - ${libosssl} - ${liblogging} - ${libchainbase} - ${libbuiltins} - ${libsecp256k1} + target_link_libraries( ${test_name} + ${LLVM} + ${libtester} + ${libchain} + ${libfc} + ${libbinaryen} + ${libwast} + ${libwasm} + ${libruntime} + ${libplatform} + ${libir} + ${libsoftfloat} + ${liboscrypto} + ${libosssl} + ${liblogging} + ${libchainbase} + ${libbuiltins} + ${libsecp256k1} LLVMX86Disassembler LLVMX86AsmParser @@ -120,11 +120,9 @@ macro(add_eosio_test test_name) ${Boost_INCLUDE_DIRS} @OPENSSL_INCLUDE_DIR@ @CMAKE_INSTALL_PREFIX@ - @CMAKE_INSTALL_FULL_INCLUDEDIR@ - @CMAKE_INSTALL_FULL_INCLUDEDIR@/eosio - @CMAKE_INSTALL_FULL_INCLUDEDIR@/eosio/wasm-jit/Include - @CMAKE_INSTALL_FULL_INCLUDEDIR@/eosio/softfloat/include - ${CMAKE_CURRENT_BINARY_DIR}/include ) + @CMAKE_INSTALL_FULL_INCLUDEDIR@ + @CMAKE_INSTALL_FULL_INCLUDEDIR@/wasm-jit + @CMAKE_INSTALL_FULL_INCLUDEDIR@/softfloat ) #Manually run unit_test for all supported runtimes #To run unit_test with all log from blockchain displayed, put --verbose after --, i.e. unit_test -- --verbose diff --git a/CMakeModules/EosioTesterBuild.cmake.in b/CMakeModules/EosioTesterBuild.cmake.in index cb1fee88c85..e4243aff86f 100644 --- a/CMakeModules/EosioTesterBuild.cmake.in +++ b/CMakeModules/EosioTesterBuild.cmake.in @@ -63,24 +63,24 @@ find_library(libsecp256k1 secp256k1 @Secp256k1_ROOT_DIR@/lib) macro(add_eosio_test test_name) add_executable( ${test_name} ${ARGN} ) - target_link_libraries( ${test_name} - ${LLVM} - ${libtester} - ${libchain} - ${libfc} - ${libbinaryen} - ${libwast} - ${libwasm} - ${libruntime} - ${libplatform} - ${libir} - ${libsoftfloat} - ${liboscrypto} - ${libosssl} - ${liblogging} - ${libchainbase} - ${libbuiltins} - ${libsecp256k1} + target_link_libraries( ${test_name} + ${LLVM} + ${libtester} + ${libchain} + ${libfc} + ${libbinaryen} + ${libwast} + ${libwasm} + ${libruntime} + ${libplatform} + ${libir} + ${libsoftfloat} + ${liboscrypto} + ${libosssl} + ${liblogging} + ${libchainbase} + ${libbuiltins} + ${libsecp256k1} LLVMX86Disassembler LLVMX86AsmParser @@ -122,13 +122,10 @@ macro(add_eosio_test test_name) @CMAKE_BINARY_DIR@/libraries/chain/include @CMAKE_SOURCE_DIR@/libraries/fc/include @CMAKE_SOURCE_DIR@/libraries/softfloat/source/include - @CMAKE_SOURCE_DIR@/libraries/softfloat/build/Linux-x86_64-GCC - @CMAKE_SOURCE_DIR@/libraries/softfloat/source/8086-SSE + @CMAKE_SOURCE_DIR@/libraries/appbase/include @CMAKE_SOURCE_DIR@/libraries/chainbase/include - @CMAKE_SOURCE_DIR@/libraries/builtins @CMAKE_SOURCE_DIR@/libraries/testing/include - @CMAKE_SOURCE_DIR@/libraries/wasm-jit/Include - ${CMAKE_CURRENT_BINARY_DIR}/include ) + @CMAKE_SOURCE_DIR@/libraries/wasm-jit/Include ) # #Manually run unit_test for all supported runtimes #To run unit_test with all log from blockchain displayed, put --verbose after --, i.e. unit_test -- --verbose diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index c672f7d5f4a..af540a38eca 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -67,6 +67,7 @@ install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/ DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/chain FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" PATTERN "webassembly" EXCLUDE ) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/eosio/chain/core_symbol.hpp DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/chain) #if(MSVC) # set_source_files_properties( db_init.cpp db_block.cpp database.cpp block_log.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) #endif(MSVC) From d91dfc86b4546eaa3e398ab99a624655729538d9 Mon Sep 17 00:00:00 2001 From: Jonathan Giszczak Date: Wed, 1 Aug 2018 12:49:44 -0500 Subject: [PATCH 24/27] Compute CPU core count from lscpu parseable output Eliminates problems caused by locale-specific variances in human readable output. Resolves #4920. --- scripts/eosio_build_amazon.sh | 2 +- scripts/eosio_build_centos.sh | 2 +- scripts/eosio_build_fedora.sh | 2 +- scripts/eosio_build_ubuntu.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/eosio_build_amazon.sh b/scripts/eosio_build_amazon.sh index e33e2714cb2..df9b4b7f90c 100644 --- a/scripts/eosio_build_amazon.sh +++ b/scripts/eosio_build_amazon.sh @@ -2,7 +2,7 @@ MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\ -f2 ) CPU_SPEED=$( lscpu | grep "MHz" | tr -s ' ' | cut -d\ -f3 | cut -d'.' -f1 ) - CPU_CORE=$( lscpu | grep "^CPU(s)" | tr -s ' ' | cut -d\ -f2 ) + CPU_CORE=$( lscpu -pCPU | grep -v "#" | wc -l ) MEM_GIG=$(( ((MEM_MEG / 1000) / 2) )) JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index 8e9003e14cc..25305db6ac5 100644 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -3,7 +3,7 @@ MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\ -f2 ) CPU_SPEED=$( lscpu | grep "MHz" | tr -s ' ' | cut -d\ -f3 | cut -d'.' -f1 ) - CPU_CORE=$( lscpu | grep "^CPU(s)" | tr -s ' ' | cut -d\ -f2 ) + CPU_CORE=$( lscpu -pCPU | grep -v "#" | wc -l ) MEM_GIG=$(( ((MEM_MEG / 1000) / 2) )) JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) diff --git a/scripts/eosio_build_fedora.sh b/scripts/eosio_build_fedora.sh index 36a704a9217..ca0cdb8e3b7 100644 --- a/scripts/eosio_build_fedora.sh +++ b/scripts/eosio_build_fedora.sh @@ -2,7 +2,7 @@ MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\ -f2 ) CPU_SPEED=$( lscpu | grep "MHz" | tr -s ' ' | cut -d\ -f3 | cut -d'.' -f1 ) - CPU_CORE=$( lscpu | grep "^CPU(s)" | tr -s ' ' | cut -d\ -f2 ) + CPU_CORE=$( lscpu -pCPU | grep -v "#" | wc -l ) MEM_GIG=$(( ((MEM_MEG / 1000) / 2) )) JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index a1151c51c7c..c5f066c3a12 100644 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -4,7 +4,7 @@ MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\ -f2 || cut -d' ' -f2 ) CPU_SPEED=$( lscpu | grep -m1 "MHz" | tr -s ' ' | cut -d\ -f3 || cut -d' ' -f3 | cut -d'.' -f1 ) - CPU_CORE=$( lscpu | grep "^CPU(s)" | tr -s ' ' | cut -d\ -f2 || cut -d' ' -f2 ) + CPU_CORE=$( lscpu -pCPU | grep -v "#" | wc -l ) MEM_GIG=$(( ((MEM_MEG / 1000) / 2) )) JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) From 6c08c3f20196579632fb4cf77461ba9df13656a7 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 1 Aug 2018 15:42:46 -0400 Subject: [PATCH 25/27] Update privileged.h Add missing declaration to maintain parity with eosio.wasmsdk/eosiolib --- contracts/eosiolib/privileged.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/contracts/eosiolib/privileged.h b/contracts/eosiolib/privileged.h index 80570d31656..8943a09db23 100644 --- a/contracts/eosiolib/privileged.h +++ b/contracts/eosiolib/privileged.h @@ -18,9 +18,19 @@ extern "C" { * @{ */ + /** + * @brief Get the resource limits of an account + * Get the resource limits of an account + * @param account - name of the account whose resource limit to get + * @param ram_bytes - pointer to `int64_t` to hold retrieved ram limit in absolute bytes + * @param net_weight - pointer to `int64_t` to hold net limit + * @param cpu_weight - pointer to `int64_t` to hold cpu limit + */ + void get_resource_limits( account_name account, int64_t* ram_bytes, int64_t* net_weight, int64_t* cpu_weight ); + /** - * @brief Set the resource limit of an account - * Set the resource limit of an account + * @brief Set the resource limits of an account + * Set the resource limits of an account * @param account - name of the account whose resource limit to be set * @param ram_bytes - ram limit in absolute bytes * @param net_weight - fractionally proportionate net limit of available resources based on (weight / total_weight_of_all_accounts) From 2bcf4a78e4976517e78382119b0f5d4aeda641b3 Mon Sep 17 00:00:00 2001 From: Bart Wyatt Date: Wed, 1 Aug 2018 17:28:35 -0400 Subject: [PATCH 26/27] Consolidated Security Fixes for 1.1.2 - Optimize block_status tracking in bnet_plugin - Optimize connection releasing in net_plugin - Move misaligned array copy to heap - Dissallow scheduled transactions from using subjective leeway cpu time - Respect wall-clock deadline for blocks in the producer_plugin::start_block - Serialize transactions in cleos instead of using an RPC Co-authored-by: Kevin Heifner Co-authored-by: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Co-authored-by: Kayan Co-authored-by: Anton Perkov --- libraries/chain/controller.cpp | 3 +- .../eosio/chain/webassembly/binaryen.hpp | 4 +- .../include/eosio/chain/webassembly/wavm.hpp | 4 +- plugins/bnet_plugin/bnet_plugin.cpp | 75 +++----- plugins/net_plugin/net_plugin.cpp | 32 +-- .../eosio/producer_plugin/producer_plugin.hpp | 3 +- plugins/producer_plugin/producer_plugin.cpp | 63 ++++-- programs/cleos/main.cpp | 182 ++++++++---------- 8 files changed, 181 insertions(+), 185 deletions(-) diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index cbd50207a87..482fbc7b730 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -573,6 +573,7 @@ struct controller_impl { in_trx_requiring_checks = true; transaction_context trx_context( self, dtrx, gtrx.trx_id ); + trx_context.leeway = fc::microseconds(0); // avoid stealing cpu resource trx_context.deadline = deadline; trx_context.billed_cpu_time_us = billed_cpu_time_us; transaction_trace_ptr trace = trx_context.trace; @@ -761,7 +762,7 @@ struct controller_impl { void start_block( block_timestamp_type when, uint16_t confirm_block_count, controller::block_status s ) { EOS_ASSERT( !pending, block_validate_exception, "pending block is not available" ); - EOS_ASSERT( db.revision() == head->block_num, database_exception, "db revision is not on par with head block", + EOS_ASSERT( db.revision() == head->block_num, database_exception, "db revision is not on par with head block", ("db.revision()", db.revision())("controller_head_block", head->block_num)("fork_db_head_block", fork_db.head()->block_num) ); auto guard_pending = fc::make_scoped_exit([this](){ diff --git a/libraries/chain/include/eosio/chain/webassembly/binaryen.hpp b/libraries/chain/include/eosio/chain/webassembly/binaryen.hpp index a7d2f12ee3d..51e908edbbd 100644 --- a/libraries/chain/include/eosio/chain/webassembly/binaryen.hpp +++ b/libraries/chain/include/eosio/chain/webassembly/binaryen.hpp @@ -358,7 +358,7 @@ struct intrinsic_invoker_impl, size_t, Inputs...>> T* base = array_ptr_impl(interface, ptr, length); if ( reinterpret_cast(base) % alignof(T) != 0 ) { wlog( "misaligned array of const values" ); - std::remove_const_t copy[length]; + std::vector > copy(length > 0 ? length : 1); T* copy_ptr = ©[0]; memcpy( (void*)copy_ptr, (void*)base, length * sizeof(T) ); return Then(interface, static_cast>(copy_ptr), length, rest..., args, (uint32_t)offset - 2); @@ -374,7 +374,7 @@ struct intrinsic_invoker_impl, size_t, Inputs...>> T* base = array_ptr_impl(interface, ptr, length); if ( reinterpret_cast(base) % alignof(T) != 0 ) { wlog( "misaligned array of values" ); - std::remove_const_t copy[length]; + std::vector > copy(length > 0 ? length : 1); T* copy_ptr = ©[0]; memcpy( (void*)copy_ptr, (void*)base, length * sizeof(T) ); Ret ret = Then(interface, static_cast>(copy_ptr), length, rest..., args, (uint32_t)offset - 2); diff --git a/libraries/chain/include/eosio/chain/webassembly/wavm.hpp b/libraries/chain/include/eosio/chain/webassembly/wavm.hpp index aa4f7b5f8ee..4674c97e2a8 100644 --- a/libraries/chain/include/eosio/chain/webassembly/wavm.hpp +++ b/libraries/chain/include/eosio/chain/webassembly/wavm.hpp @@ -383,7 +383,7 @@ struct intrinsic_invoker_impl, size_t, Inputs...>, T* base = array_ptr_impl(ctx, (U32)ptr, length); if ( reinterpret_cast(base) % alignof(T) != 0 ) { wlog( "misaligned array of const values" ); - std::remove_const_t copy[length]; + std::vector > copy(length > 0 ? length : 1); T* copy_ptr = ©[0]; memcpy( (void*)copy_ptr, (void*)base, length * sizeof(T) ); return Then(ctx, static_cast>(copy_ptr), length, rest..., translated...); @@ -398,7 +398,7 @@ struct intrinsic_invoker_impl, size_t, Inputs...>, T* base = array_ptr_impl(ctx, (U32)ptr, length); if ( reinterpret_cast(base) % alignof(T) != 0 ) { wlog( "misaligned array of values" ); - std::remove_const_t copy[length]; + std::vector > copy(length > 0 ? length : 1); T* copy_ptr = ©[0]; memcpy( (void*)copy_ptr, (void*)base, length * sizeof(T) ); Ret ret = Then(ctx, static_cast>(copy_ptr), length, rest..., translated...); diff --git a/plugins/bnet_plugin/bnet_plugin.cpp b/plugins/bnet_plugin/bnet_plugin.cpp index 17d12c421d2..9de47f0169b 100644 --- a/plugins/bnet_plugin/bnet_plugin.cpp +++ b/plugins/bnet_plugin/bnet_plugin.cpp @@ -518,23 +518,22 @@ namespace eosio { void on_accepted_block_header( const block_state_ptr& s ) { verify_strand_in_this_thread(_strand, __func__, __LINE__); // ilog( "accepted block header ${n}", ("n",s->block_num) ); + const auto& id = s->id; + if( fc::time_point::now() - s->block->timestamp < fc::seconds(6) ) { // ilog( "queue notice to peer that we have this block so hopefully they don't send it to us" ); - auto itr = _block_status.find(s->id); + auto itr = _block_status.find( id ); if( !_remote_request_irreversible_only && ( itr == _block_status.end() || !itr->received_from_peer ) ) { - _block_header_notices.insert(s->id); + _block_header_notices.insert( id ); + } + if( itr == _block_status.end() ) { + _block_status.insert( block_status(id, false, false) ); } } //idump((_block_status.size())(_transaction_status.size())); - auto id = s->id; //ilog( "accepted block ${n}", ("n",s->block_num) ); - auto itr = _block_status.find( id ); - if( itr == _block_status.end() ) { - itr = _block_status.insert( block_status(id, false, false) ).first; - } - _local_head_block_id = id; _local_head_block_num = block_header::num_from_id(id); @@ -550,8 +549,8 @@ namespace eosio { */ for( const auto& receipt : s->block->transactions ) { if( receipt.trx.which() == 1 ) { - auto id = receipt.trx.get().id(); - auto itr = _transaction_status.find( id ); + const auto tid = receipt.trx.get().id(); + auto itr = _transaction_status.find( tid ); if( itr != _transaction_status.end() ) _transaction_status.erase(itr); } @@ -644,36 +643,24 @@ namespace eosio { std::placeholders::_2 ) ) ); } FC_LOG_AND_RETHROW() } - void mark_block_known_by_peer( block_id_type id) { - auto itr = _block_status.find(id); - if( itr == _block_status.end() ) { - // optimization to avoid sending blocks to nodes that already know about them - // to avoid unbounded memory growth limit number tracked - auto min_block_num = std::min( _local_lib, _last_sent_block_num ); - auto max_block_num = min_block_num + _max_block_status_range; - auto block_num = block_header::num_from_id(id); - if(block_num > min_block_num && block_num < max_block_num) - _block_status.insert( block_status(id, true, false) ); - } else { - _block_status.modify( itr, [&]( auto& item ) { - item.known_by_peer = true; - }); - } - } - - void mark_block_recv_from_peer( block_id_type id ) { - auto itr = _block_status.find(id); - if( itr == _block_status.end() ) { - _block_status.insert( block_status(id, true, true) ); - } else { - _block_status.modify( itr, [&]( auto& item ) { - item.known_by_peer = true; - item.received_from_peer = true; - }); - } + void mark_block_status( const block_id_type& id, bool known_by_peer, bool recv_from_peer ) { + auto itr = _block_status.find(id); + if( itr == _block_status.end() ) { + // optimization to avoid sending blocks to nodes that already know about them + // to avoid unbounded memory growth limit number tracked + const auto min_block_num = std::min( _local_lib, _last_sent_block_num ); + const auto max_block_num = min_block_num + _max_block_status_range; + const auto block_num = block_header::num_from_id( id ); + if( block_num > min_block_num && block_num < max_block_num && _block_status.size() < _max_block_status_range ) + _block_status.insert( block_status( id, known_by_peer, recv_from_peer ) ); + } else { + _block_status.modify( itr, [&]( auto& item ) { + item.known_by_peer = known_by_peer; + if (recv_from_peer) item.received_from_peer = true; + }); + } } - /** * This method will determine whether there is a message in the * out queue, if so it returns. Otherwise it determines the best @@ -819,7 +806,7 @@ namespace eosio { return; } - mark_block_known_by_peer( next_id ); + mark_block_status( next_id, true, false ); _last_sent_block_id = next_id; _last_sent_block_num = nextblock->block_num(); @@ -930,7 +917,7 @@ namespace eosio { ); } - void on_message( const bnet_message& msg, fc::datastream& ds ) { + void on_message( const bnet_message& msg, fc::datastream& ds ) { try { switch( msg.which() ) { case bnet_message::tag::value: @@ -967,11 +954,11 @@ namespace eosio { peer_ilog(this, "received block_notice"); for( const auto& id : notice.block_ids ) { status( "received notice " + std::to_string( block_header::num_from_id(id) ) ); - mark_block_known_by_peer( id ); + mark_block_status( id, true, false ); } } - void on( const hello& hi, fc::datastream& ds ); + void on( const hello& hi, fc::datastream& ds ); void on( const ping& p ) { peer_ilog(this, "received ping"); @@ -1009,7 +996,7 @@ namespace eosio { status( "received block " + std::to_string(b->block_num()) ); //ilog( "recv block ${n}", ("n", b->block_num()) ); auto id = b->id(); - mark_block_recv_from_peer( id ); + mark_block_status( id, true, true ); app().get_channel().publish(b); @@ -1526,7 +1513,7 @@ namespace eosio { _remote_lib = hi.last_irr_block_num; for( const auto& id : hi.pending_block_ids ) - mark_block_known_by_peer( id ); + mark_block_status( id, true, false ); check_for_redundant_connection(); diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index a77f4084681..5363f035210 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -751,12 +751,7 @@ namespace eosio { initialize(); } - connection::~connection() { - if(peer_addr.empty()) - wlog( "released connection from client" ); - else - wlog( "released connection to server at ${addr}", ("addr", peer_addr) ); - } + connection::~connection() {} void connection::initialize() { auto *rnd = node_id.data(); @@ -2669,27 +2664,18 @@ namespace eosio { void net_plugin_impl::connection_monitor( ) { start_conn_timer(); - vector discards; - num_clients = 0; - for( auto &c : connections ) { - if( !c->socket->is_open() && !c->connecting) { - if( c->peer_addr.length() > 0) { - connect(c); + auto it = connections.begin(); + while(it != connections.end()) { + if( !(*it)->socket->is_open() && !(*it)->connecting) { + if( (*it)->peer_addr.length() > 0) { + connect(*it); } else { - discards.push_back( c); - } - } else { - if( c->socket->is_open() && c->peer_addr.empty()) { - num_clients++; + it = connections.erase(it); + continue; } } - } - if( discards.size( ) ) { - for( auto &c : discards) { - connections.erase( c ); - c.reset(); - } + ++it; } } diff --git a/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp b/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp index 4b64b7bb73d..b083de7bbb1 100644 --- a/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp +++ b/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp @@ -24,6 +24,7 @@ class producer_plugin : public appbase::plugin { fc::optional produce_time_offset_us; fc::optional last_block_time_offset_us; fc::optional subjective_cpu_leeway_us; + fc::optional incoming_defer_ratio; }; struct greylist_params { @@ -62,6 +63,6 @@ class producer_plugin : public appbase::plugin { } //eosio -FC_REFLECT(eosio::producer_plugin::runtime_options, (max_transaction_time)(max_irreversible_block_age)(produce_time_offset_us)(last_block_time_offset_us)(subjective_cpu_leeway_us)); +FC_REFLECT(eosio::producer_plugin::runtime_options, (max_transaction_time)(max_irreversible_block_age)(produce_time_offset_us)(last_block_time_offset_us)(subjective_cpu_leeway_us)(incoming_defer_ratio)); FC_REFLECT(eosio::producer_plugin::greylist_params, (accounts)); diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index d4be760a06c..1e8e6244150 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -36,6 +36,7 @@ using boost::multi_index_container; using std::string; using std::vector; +using std::deque; using boost::signals2::scoped_connection; // HACK TO EXPOSE LOGGER MAP @@ -167,6 +168,9 @@ class producer_plugin_impl : public std::enable_shared_from_thisheader.timestamp <= _last_signed_block_time ) return; @@ -328,7 +332,7 @@ class producer_plugin_impl : public std::enable_shared_from_this>> _pending_incoming_transactions; + std::deque>> _pending_incoming_transactions; void on_incoming_transaction_async(const packed_transaction_ptr& trx, bool persist_until_expired, next_function next) { chain::controller& chain = app().get_plugin().chain(); @@ -480,6 +484,8 @@ void producer_plugin::set_program_options( "offset of non last block producing time in micro second. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later") ("last-block-time-offset-us", boost::program_options::value()->default_value(0), "offset of last block producing time in micro second. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later") + ("incoming-defer-ratio", bpo::value()->default_value(1.0), + "ratio between incoming transations and deferred transactions when both are exhausted") ; config_file_options.add(producer_options); } @@ -600,6 +606,8 @@ void producer_plugin::plugin_initialize(const boost::program_options::variables_ my->_max_irreversible_block_age_us = fc::seconds(options.at("max-irreversible-block-age").as()); + my->_incoming_defer_ratio = options.at("incoming-defer-ratio").as(); + my->_incoming_block_subscription = app().get_channel().subscribe([this](const signed_block_ptr& block){ try { my->on_incoming_block(block); @@ -721,6 +729,10 @@ void producer_plugin::update_runtime_options(const runtime_options& options) { my->_last_block_time_offset_us = *options.last_block_time_offset_us; } + if (options.incoming_defer_ratio) { + my->_incoming_defer_ratio = *options.incoming_defer_ratio; + } + if (check_speculating && my->_pending_block_mode == pending_block_mode::speculating) { chain::controller& chain = app().get_plugin().chain(); chain.abort_block(); @@ -944,8 +956,11 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block(bool } } + size_t orig_pending_txn_size = _pending_incoming_transactions.size(); + if (_pending_block_mode == pending_block_mode::producing) { for (const auto& trx : unapplied_trxs) { + if (block_time <= fc::time_point::now()) exhausted = true; if (exhausted) { break; } @@ -992,11 +1007,27 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block(bool } auto scheduled_trxs = chain.get_scheduled_transactions(); + for (const auto& trx : scheduled_trxs) { + if (block_time <= fc::time_point::now()) exhausted = true; if (exhausted) { break; } + // configurable ratio of incoming txns vs deferred txns + while (_incoming_trx_weight >= 1.0 && orig_pending_txn_size && _pending_incoming_transactions.size()) { + auto e = _pending_incoming_transactions.front(); + _pending_incoming_transactions.pop_front(); + --orig_pending_txn_size; + _incoming_trx_weight -= 1.0; + on_incoming_transaction_async(std::get<0>(e), std::get<1>(e), std::get<2>(e)); + } + + if (block_time <= fc::time_point::now()) { + exhausted = true; + break; + } + if (blacklist_by_id.find(trx) != blacklist_by_id.end()) { continue; } @@ -1023,21 +1054,24 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block(bool app().get_plugin().handle_guard_exception(e); return start_block_result::failed; } FC_LOG_AND_DROP(); + + _incoming_trx_weight += _incoming_defer_ratio; + if (!orig_pending_txn_size) _incoming_trx_weight = 0.0; } } - if (exhausted) { + if (exhausted || block_time <= fc::time_point::now()) { return start_block_result::exhausted; } else { // attempt to apply any pending incoming transactions - if (!_pending_incoming_transactions.empty()) { - auto old_pending = std::move(_pending_incoming_transactions); - _pending_incoming_transactions.clear(); - for (auto& e: old_pending) { - on_incoming_transaction_async(std::get<0>(e), std::get<1>(e), std::get<2>(e)); - } + _incoming_trx_weight = 0.0; + if (orig_pending_txn_size && _pending_incoming_transactions.size()) { + auto e = _pending_incoming_transactions.front(); + _pending_incoming_transactions.pop_front(); + --orig_pending_txn_size; + on_incoming_transaction_async(std::get<0>(e), std::get<1>(e), std::get<2>(e)); + if (block_time <= fc::time_point::now()) return start_block_result::exhausted; } - return start_block_result::succeeded; } @@ -1076,14 +1110,19 @@ void producer_plugin_impl::schedule_production_loop() { } else if (_pending_block_mode == pending_block_mode::producing) { // we succeeded but block may be exhausted + static const boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); if (result == start_block_result::succeeded) { // ship this block off no later than its deadline - static const boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); _timer.expires_at(epoch + boost::posix_time::microseconds(chain.pending_block_time().time_since_epoch().count() + (last_block ? _last_block_time_offset_us : _produce_time_offset_us))); fc_dlog(_log, "Scheduling Block Production on Normal Block #${num} for ${time}", ("num", chain.pending_block_state()->block_num)("time",chain.pending_block_time())); } else { - // ship this block off immediately - _timer.expires_from_now( boost::posix_time::microseconds( 0 )); + auto expect_time = chain.pending_block_time() - fc::microseconds(config::block_interval_us); + // ship this block off up to 1 block time earlier or immediately + if (fc::time_point::now() >= expect_time) { + _timer.expires_from_now( boost::posix_time::microseconds( 0 )); + } else { + _timer.expires_at(epoch + boost::posix_time::microseconds(expect_time.time_since_epoch().count())); + } fc_dlog(_log, "Scheduling Block Production on Exhausted Block #${num} immediately", ("num", chain.pending_block_state()->block_num)); } diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 7ec0f108489..d39df3db178 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -340,6 +340,47 @@ void print_action( const fc::variant& at ) { } } +bytes variant_to_bin( const account_name& account, const action_name& action, const fc::variant& action_args_var ) { + static unordered_map > abi_cache; + auto it = abi_cache.find( account ); + if ( it == abi_cache.end() ) { + const auto result = call(get_raw_code_and_abi_func, fc::mutable_variant_object("account_name", account)); + std::tie( it, std::ignore ) = abi_cache.emplace( account, result["abi"].as_blob().data ); + //we also received result["wasm"], but we don't use it + } + const std::vector& abi_v = it->second; + + abi_def abi; + if( abi_serializer::to_abi(abi_v, abi) ) { + abi_serializer abis( abi, fc::seconds(10) ); + auto action_type = abis.get_action_type(action); + FC_ASSERT(!action_type.empty(), "Unknown action ${action} in contract ${contract}", ("action", action)("contract", account)); + return abis.variant_to_binary(action_type, action_args_var, fc::seconds(10)); + } else { + FC_ASSERT(false, "No ABI found for ${contract}", ("contract", account)); + } +} + +fc::variant json_from_file_or_string(const string& file_or_str, fc::json::parse_type ptype = fc::json::legacy_parser) +{ + regex r("^[ \t]*[\{\[]"); + if ( !regex_search(file_or_str, r) && fc::is_regular_file(file_or_str) ) { + return fc::json::from_file(file_or_str, ptype); + } else { + return fc::json::from_string(file_or_str, ptype); + } +} + +bytes json_or_file_to_bin( const account_name& account, const action_name& action, const string& data_or_filename ) { + fc::variant action_args_var; + if( !data_or_filename.empty() ) { + try { + action_args_var = json_from_file_or_string(data_or_filename, fc::json::relaxed_parser); + } EOS_RETHROW_EXCEPTIONS(action_type_exception, "Fail to parse action JSON data='${data}'", ("data", data_or_filename)); + } + return variant_to_bin( account, action, action_args_var ); +} + void print_action_tree( const fc::variant& action ) { print_action( action ); const auto& inline_traces = action["inline_traces"].get_array(); @@ -429,14 +470,7 @@ chain::action create_newaccount(const name& creator, const name& newaccount, pub } chain::action create_action(const vector& authorization, const account_name& code, const action_name& act, const fc::variant& args) { - auto arg = fc::mutable_variant_object() - ("code", code) - ("action", act) - ("args", args); - - auto result = call(json_to_bin_func, arg); - wdump((result)(arg)); - return chain::action{authorization, code, act, result.get_object()["binargs"].as()}; + return chain::action{authorization, code, act, variant_to_bin(code, act, args)}; } chain::action create_buyram(const name& creator, const name& newaccount, const asset& quantity) { @@ -490,11 +524,9 @@ chain::action create_transfer(const string& contract, const name& sender, const ("action", "transfer") ("args", transfer); - auto result = call(json_to_bin_func, args); - return action { tx_permission.empty() ? vector{{sender,config::active_name}} : get_account_permissions(tx_permission), - contract, "transfer", result.get_object()["binargs"].as() + contract, "transfer", variant_to_bin( contract, N(transfer), transfer ) }; } @@ -540,16 +572,6 @@ chain::action create_unlinkauth(const name& account, const name& code, const nam unlinkauth{account, code, type}}; } -fc::variant json_from_file_or_string(const string& file_or_str, fc::json::parse_type ptype = fc::json::legacy_parser) -{ - regex r("^[ \t]*[\{\[]"); - if ( !regex_search(file_or_str, r) && fc::is_regular_file(file_or_str) ) { - return fc::json::from_file(file_or_str, ptype); - } else { - return fc::json::from_string(file_or_str, ptype); - } -} - authority parse_json_authority(const std::string& authorityJsonOrFile) { try { return json_from_file_or_string(authorityJsonOrFile).as(); @@ -2459,16 +2481,9 @@ int main( int argc, char** argv ) { action_args_var = json_from_file_or_string(data, fc::json::relaxed_parser); } EOS_RETHROW_EXCEPTIONS(action_type_exception, "Fail to parse action JSON data='${data}'", ("data", data)) } - - auto arg= fc::mutable_variant_object - ("code", contract_account) - ("action", action) - ("args", action_args_var); - auto result = call(json_to_bin_func, arg); - auto accountPermissions = get_account_permissions(tx_permission); - send_actions({chain::action{accountPermissions, contract_account, action, result.get_object()["binargs"].as()}}); + send_actions({chain::action{accountPermissions, contract_account, action, variant_to_bin( contract_account, action, action_args_var ) }}); }); // push transaction @@ -2548,15 +2563,7 @@ int main( int argc, char** argv ) { trx_var = json_from_file_or_string(proposed_transaction); } EOS_RETHROW_EXCEPTIONS(transaction_type_exception, "Fail to parse transaction JSON '${data}'", ("data",proposed_transaction)) transaction proposed_trx = trx_var.as(); - - auto arg = fc::mutable_variant_object() - ("code", proposed_contract) - ("action", proposed_action) - ("args", trx_var); - - auto result = call(json_to_bin_func, arg); - - bytes proposed_trx_serialized = result.get_object()["binargs"].as(); + bytes proposed_trx_serialized = variant_to_bin( proposed_contract, proposed_action, trx_var ); vector reqperm; try { @@ -2592,17 +2599,13 @@ int main( int argc, char** argv ) { fc::to_variant(trx, trx_var); - arg = fc::mutable_variant_object() - ("code", "eosio.msig") - ("action", "propose") - ("args", fc::mutable_variant_object() - ("proposer", proposer ) - ("proposal_name", proposal_name) - ("requested", requested_perm_var) - ("trx", trx_var) - ); - result = call(json_to_bin_func, arg); - send_actions({chain::action{accountPermissions, "eosio.msig", "propose", result.get_object()["binargs"].as()}}); + auto args = fc::mutable_variant_object() + ("proposer", proposer ) + ("proposal_name", proposal_name) + ("requested", requested_perm_var) + ("trx", trx_var); + + send_actions({chain::action{accountPermissions, "eosio.msig", "propose", variant_to_bin( N(eosio.msig), N(propose), args ) }}); }); //resolver for ABI serializer to decode actions in proposed transaction in multisig contract @@ -2648,17 +2651,13 @@ int main( int argc, char** argv ) { proposer = name(accountPermissions.at(0).actor).to_string(); } - auto arg = fc::mutable_variant_object() - ("code", "eosio.msig") - ("action", "propose") - ("args", fc::mutable_variant_object() - ("proposer", proposer ) - ("proposal_name", proposal_name) - ("requested", requested_perm_var) - ("trx", trx_var) - ); - auto result = call(json_to_bin_func, arg); - send_actions({chain::action{accountPermissions, "eosio.msig", "propose", result.get_object()["binargs"].as()}}); + auto args = fc::mutable_variant_object() + ("proposer", proposer ) + ("proposal_name", proposal_name) + ("requested", requested_perm_var) + ("trx", trx_var); + + send_actions({chain::action{accountPermissions, "eosio.msig", "propose", variant_to_bin( N(eosio.msig), N(propose), args ) }}); }); @@ -2708,17 +2707,13 @@ int main( int argc, char** argv ) { try { perm_var = json_from_file_or_string(perm); } EOS_RETHROW_EXCEPTIONS(transaction_type_exception, "Fail to parse permissions JSON '${data}'", ("data",perm)) - auto arg = fc::mutable_variant_object() - ("code", "eosio.msig") - ("action", action) - ("args", fc::mutable_variant_object() - ("proposer", proposer) - ("proposal_name", proposal_name) - ("level", perm_var) - ); - auto result = call(json_to_bin_func, arg); + auto args = fc::mutable_variant_object() + ("proposer", proposer) + ("proposal_name", proposal_name) + ("level", perm_var); + auto accountPermissions = tx_permission.empty() ? vector{{sender,config::active_name}} : get_account_permissions(tx_permission); - send_actions({chain::action{accountPermissions, "eosio.msig", action, result.get_object()["binargs"].as()}}); + send_actions({chain::action{accountPermissions, "eosio.msig", action, variant_to_bin( N(eosio.msig), action, args ) }}); }; // multisig approve @@ -2756,16 +2751,12 @@ int main( int argc, char** argv ) { if (canceler.empty()) { canceler = name(accountPermissions.at(0).actor).to_string(); } - auto arg = fc::mutable_variant_object() - ("code", "eosio.msig") - ("action", "cancel") - ("args", fc::mutable_variant_object() - ("proposer", proposer) - ("proposal_name", proposal_name) - ("canceler", canceler) - ); - auto result = call(json_to_bin_func, arg); - send_actions({chain::action{accountPermissions, "eosio.msig", "cancel", result.get_object()["binargs"].as()}}); + auto args = fc::mutable_variant_object() + ("proposer", proposer) + ("proposal_name", proposal_name) + ("canceler", canceler); + + send_actions({chain::action{accountPermissions, "eosio.msig", "cancel", variant_to_bin( N(eosio.msig), N(cancel), args ) }}); } ); @@ -2789,17 +2780,12 @@ int main( int argc, char** argv ) { executer = name(accountPermissions.at(0).actor).to_string(); } - auto arg = fc::mutable_variant_object() - ("code", "eosio.msig") - ("action", "exec") - ("args", fc::mutable_variant_object() - ("proposer", proposer ) - ("proposal_name", proposal_name) - ("executer", executer) - ); - auto result = call(json_to_bin_func, arg); - //std::cout << "Result: " << result << std::endl; - send_actions({chain::action{accountPermissions, "eosio.msig", "exec", result.get_object()["binargs"].as()}}); + auto args = fc::mutable_variant_object() + ("proposer", proposer ) + ("proposal_name", proposal_name) + ("executer", executer); + + send_actions({chain::action{accountPermissions, "eosio.msig", "exec", variant_to_bin( N(eosio.msig), N(exec), args ) }}); } ); @@ -2826,15 +2812,11 @@ int main( int argc, char** argv ) { accountPermissions = vector{{executer, config::active_name}, {"eosio.sudo", config::active_name}}; } - auto arg = fc::mutable_variant_object() - ("code", "eosio.sudo") - ("action", "exec") - ("args", fc::mutable_variant_object() - ("executer", executer ) - ("trx", trx_var) - ); - auto result = call(json_to_bin_func, arg); - send_actions({chain::action{accountPermissions, "eosio.sudo", "exec", result.get_object()["binargs"].as()}}); + auto args = fc::mutable_variant_object() + ("executer", executer ) + ("trx", trx_var); + + send_actions({chain::action{accountPermissions, "eosio.sudo", "exec", variant_to_bin( N(eosio.sudo), N(exec), args ) }}); }); // system subcommand From 238c790ccfbca905b767b0ec00fad54e82a7dadc Mon Sep 17 00:00:00 2001 From: Bart Wyatt Date: Wed, 1 Aug 2018 21:12:16 -0400 Subject: [PATCH 27/27] bump version to 1.1.2 --- CMakeLists.txt | 2 +- Docker/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66d9d2ee38f..cbc2123d351 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ set( CXX_STANDARD_REQUIRED ON) set(VERSION_MAJOR 1) set(VERSION_MINOR 1) -set(VERSION_PATCH 1) +set(VERSION_PATCH 2) set( CLI_CLIENT_EXECUTABLE_NAME cleos ) set( GUI_CLIENT_EXECUTABLE_NAME eosio ) diff --git a/Docker/README.md b/Docker/README.md index 9eb3874adf5..faac50468e5 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -20,10 +20,10 @@ cd eos/Docker docker build . -t eosio/eos ``` -The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v1.1.1 tag, you could do the following: +The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v1.1.2 tag, you could do the following: ```bash -docker build -t eosio/eos:v1.1.1 --build-arg branch=v1.1.1 . +docker build -t eosio/eos:v1.1.2 --build-arg branch=v1.1.2 . ``` By default, the symbol in eosio.system is set to SYS. You can override this using the symbol argument while building the docker image.