提交 7ab4b6d5 编写于 作者: A arhag

Merge branch 'master' into add-double-secondary-index

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