Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
7ab4b6d5
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7ab4b6d5
编写于
3月 12, 2018
作者:
A
arhag
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into add-double-secondary-index
上级
bdba40c0
4be244f4
变更
80
显示空白变更内容
内联
并排
Showing
80 changed file
with
1035 addition
and
580 deletion
+1035
-580
CMakeLists.txt
CMakeLists.txt
+44
-14
CMakeModules/FindSoftfloat.cmake
CMakeModules/FindSoftfloat.cmake
+11
-0
CMakeModules/FindWasm.cmake
CMakeModules/FindWasm.cmake
+11
-0
CMakeModules/InstallDirectoryPermissions.cmake
CMakeModules/InstallDirectoryPermissions.cmake
+14
-0
CMakeModules/installer.cmake
CMakeModules/installer.cmake
+28
-15
CMakeModules/wasm.cmake
CMakeModules/wasm.cmake
+3
-0
Docker/Dockerfile
Docker/Dockerfile
+16
-8
Jenkinsfile
Jenkinsfile
+24
-0
contracts/CMakeLists.txt
contracts/CMakeLists.txt
+17
-4
contracts/asserter/asserter.cpp
contracts/asserter/asserter.cpp
+1
-1
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+2
-2
contracts/eosiolib/compiler_builtins.h
contracts/eosiolib/compiler_builtins.h
+21
-0
contracts/eosiolib/fixedpoint.hpp
contracts/eosiolib/fixedpoint.hpp
+6
-6
contracts/eosiolib/generic_currency.hpp
contracts/eosiolib/generic_currency.hpp
+2
-2
contracts/eosiolib/print.hpp
contracts/eosiolib/print.hpp
+2
-2
contracts/eosiolib/real.hpp
contracts/eosiolib/real.hpp
+1
-1
contracts/eosiolib/singleton.hpp
contracts/eosiolib/singleton.hpp
+1
-1
contracts/identity/identity.hpp
contracts/identity/identity.hpp
+1
-1
contracts/identity/test/identity_test.cpp
contracts/identity/test/identity_test.cpp
+2
-2
contracts/libc++/upstream
contracts/libc++/upstream
+1
-1
contracts/multi_index_test/CMakeLists.txt
contracts/multi_index_test/CMakeLists.txt
+1
-3
contracts/musl/CMakeLists.txt
contracts/musl/CMakeLists.txt
+4
-4
contracts/musl/upstream
contracts/musl/upstream
+1
-1
contracts/noop/noop.hpp
contracts/noop/noop.hpp
+0
-2
contracts/simpledb/simpledb.cpp
contracts/simpledb/simpledb.cpp
+16
-16
contracts/test.system/test.system.abi
contracts/test.system/test.system.abi
+3
-3
contracts/test_api/test_action.cpp
contracts/test_api/test_action.cpp
+2
-2
contracts/test_api/test_api.cpp
contracts/test_api/test_api.cpp
+1
-1
contracts/test_api/test_api.hpp
contracts/test_api/test_api.hpp
+1
-1
contracts/test_api/test_compiler_builtins.cpp
contracts/test_api/test_compiler_builtins.cpp
+81
-82
contracts/test_api/test_crypto.cpp
contracts/test_api/test_crypto.cpp
+5
-8
contracts/test_api/test_fixedpoint.cpp
contracts/test_api/test_fixedpoint.cpp
+76
-74
contracts/test_api/test_math.cpp
contracts/test_api/test_math.cpp
+8
-10
contracts/test_api/test_print.cpp
contracts/test_api/test_print.cpp
+22
-21
contracts/test_api/test_real.cpp
contracts/test_api/test_real.cpp
+4
-0
contracts/test_api/test_transaction.cpp
contracts/test_api/test_transaction.cpp
+16
-15
contracts/test_api/test_types.cpp
contracts/test_api/test_types.cpp
+2
-2
contracts/test_api_db/test_db.cpp
contracts/test_api_db/test_db.cpp
+22
-23
contracts/test_api_mem/test_api_mem.cpp
contracts/test_api_mem/test_api_mem.cpp
+1
-1
contracts/test_api_mem/test_extended_memory.cpp
contracts/test_api_mem/test_extended_memory.cpp
+3
-3
contracts/test_api_mem/test_memory.cpp
contracts/test_api_mem/test_memory.cpp
+1
-2
debian/CMakeLists.txt
debian/CMakeLists.txt
+1
-0
debian/postinst
debian/postinst
+58
-0
eosio_build.sh
eosio_build.sh
+28
-1
libraries/abi_generator/CMakeLists.txt
libraries/abi_generator/CMakeLists.txt
+3
-3
libraries/appbase
libraries/appbase
+1
-1
libraries/chain/chain_controller.cpp
libraries/chain/chain_controller.cpp
+4
-4
libraries/chain/include/eosio/chain/config.hpp
libraries/chain/include/eosio/chain/config.hpp
+4
-2
libraries/chain/include/eosio/chain/softfloat.hpp
libraries/chain/include/eosio/chain/softfloat.hpp
+2
-98
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+121
-3
libraries/chainbase
libraries/chainbase
+1
-1
libraries/fc/CMakeLists.txt
libraries/fc/CMakeLists.txt
+3
-3
plugins/CMakeLists.txt
plugins/CMakeLists.txt
+3
-0
plugins/account_history_api_plugin/CMakeLists.txt
plugins/account_history_api_plugin/CMakeLists.txt
+1
-1
plugins/chain_plugin/chain_plugin.cpp
plugins/chain_plugin/chain_plugin.cpp
+6
-2
plugins/mongo_db_plugin/CMakeLists.txt
plugins/mongo_db_plugin/CMakeLists.txt
+2
-0
plugins/net_plugin/CMakeLists.txt
plugins/net_plugin/CMakeLists.txt
+1
-1
plugins/net_plugin/net_plugin.cpp
plugins/net_plugin/net_plugin.cpp
+1
-1
plugins/template_plugin/template_plugin.cpp
plugins/template_plugin/template_plugin.cpp
+1
-0
plugins/txn_test_gen_plugin/CMakeLists.txt
plugins/txn_test_gen_plugin/CMakeLists.txt
+2
-0
plugins/wallet_plugin/wallet_plugin.cpp
plugins/wallet_plugin/wallet_plugin.cpp
+2
-0
programs/debug_node/CMakeLists.txt
programs/debug_node/CMakeLists.txt
+3
-3
programs/eosio-abigen/CMakeLists.txt
programs/eosio-abigen/CMakeLists.txt
+3
-3
programs/eosio-applesedemo/CMakeLists.txt
programs/eosio-applesedemo/CMakeLists.txt
+3
-3
programs/eosio-launcher/CMakeLists.txt
programs/eosio-launcher/CMakeLists.txt
+3
-3
programs/eosio-launcher/main.cpp
programs/eosio-launcher/main.cpp
+35
-1
programs/eosioc/CMakeLists.txt
programs/eosioc/CMakeLists.txt
+3
-3
programs/eosioc/main.cpp
programs/eosioc/main.cpp
+1
-1
programs/eosiod/CMakeLists.txt
programs/eosiod/CMakeLists.txt
+23
-3
programs/eosiod/main.cpp
programs/eosiod/main.cpp
+61
-35
programs/eosiowd/CMakeLists.txt
programs/eosiowd/CMakeLists.txt
+3
-3
programs/eosiowd/main.cpp
programs/eosiowd/main.cpp
+20
-2
scripts/CMakeLists.txt
scripts/CMakeLists.txt
+1
-0
scripts/abi_is_json.py
scripts/abi_is_json.py
+26
-0
scripts/eosio_build_ubuntu.sh
scripts/eosio_build_ubuntu.sh
+16
-5
tests/eosiod_run_test.py
tests/eosiod_run_test.py
+27
-9
tests/testUtils.py
tests/testUtils.py
+67
-46
tests/tests/database_tests.cpp
tests/tests/database_tests.cpp
+2
-2
tools/CMakeLists.txt
tools/CMakeLists.txt
+9
-1
tools/eosiocpp.in
tools/eosiocpp.in
+6
-2
未找到文件。
CMakeLists.txt
浏览文件 @
7ab4b6d5
# 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 eos
ioc
)
set
(
GUI_CLIENT_EXECUTABLE_NAME eos
io
)
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
)
CMakeModules/FindSoftfloat.cmake
浏览文件 @
7ab4b6d5
# - 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
)
CMakeModules/FindWasm.cmake
浏览文件 @
7ab4b6d5
# - 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
)
...
...
CMakeModules/InstallDirectoryPermissions.cmake
0 → 100644
浏览文件 @
7ab4b6d5
# 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
)
CMakeModules/installer.cmake
浏览文件 @
7ab4b6d5
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
}
"
)
...
...
@@ -22,15 +26,24 @@ if(WIN32)
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 frequent
ly do
SET
(
CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0
)
# windows zip files usually don't have a single directory inside them, unix tgz usual
ly 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
)
CMakeModules/wasm.cmake
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
Docker/Dockerfile
浏览文件 @
7ab4b6d5
...
...
@@ -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
...
...
Jenkinsfile
浏览文件 @
7ab4b6d5
...
...
@@ -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'
}
}
}
}
}
...
...
contracts/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
contracts/asserter/asserter.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
;
...
...
contracts/eosio.system/eosio.system.abi
浏览文件 @
7ab4b6d5
...
...
@@ -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"}
]
}
...
...
contracts/eosiolib/compiler_builtins.h
浏览文件 @
7ab4b6d5
...
...
@@ -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"
contracts/eosiolib/fixedpoint.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
);
}
...
...
contracts/eosiolib/generic_currency.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
,
(
s
ymbol
)(
supply
)
)
EOSLIB_SERIALIZE
(
currency_stats
,
(
s
upply
)(
symbol
)
)
};
/**
...
...
contracts/eosiolib/print.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -50,7 +50,7 @@ namespace eosio {
}
inline
void
print
(
long
num
)
{
printi
(
num
);
printi
(
uint64_t
(
num
)
);
}
/**
...
...
contracts/eosiolib/real.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
{}
...
...
contracts/eosiolib/singleton.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
;
...
...
contracts/identity/identity.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
,
...
...
contracts/identity/test/identity_test.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
;
...
...
upstream
@
2880ac42
比较
959b01fb
...
2880ac42
Subproject commit
959b01fb8b617851e260bd2218ac8ba74269fec
9
Subproject commit
2880ac42909d4bb29687ed079f8bb4405c3b086
9
contracts/multi_index_test/CMakeLists.txt
浏览文件 @
7ab4b6d5
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
)
contracts/musl/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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 MA
LLOC_SOURCES
"upstream/src/malloc
/*.c"
)
file
(
GLOB MA
TH_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
}
${
M
BYTE
_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
}
${
M
ATH
_SOURCES
}
${
M
BYTE_SOURCES
}
${
M
ISC_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
...
...
upstream
@
8a34536a
比较
ee49ba89
...
8a34536a
Subproject commit
ee49ba896db1de3c3e4f4285eb4e285b641a6cd9
Subproject commit
8a34536ac9764c90c86cc0b62d0cda07449fd5d8
contracts/noop/noop.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -7,8 +7,6 @@
#include <eosiolib/eosio.hpp>
#include <eosiolib/dispatcher.hpp>
using
namespace
eosio
;
namespace
noop
{
using
std
::
string
;
...
...
contracts/simpledb/simpledb.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
>
...
...
contracts/test.system/test.system.abi
浏览文件 @
7ab4b6d5
...
...
@@ -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",
...
...
contracts/test_api/test_action.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
()
{
...
...
contracts/test_api/test_api.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
);
...
...
contracts/test_api/test_api.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
();
...
...
contracts/test_api/test_compiler_builtins.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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"
);
}
...
...
@@ -151,18 +150,18 @@ 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"
);
}
contracts/test_api/test_crypto.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
(
in
t
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");
}
...
...
contracts/test_api/test_fixedpoint.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -2,32 +2,32 @@
#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
::
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
::
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
::
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"
);
}
...
...
@@ -37,18 +37,18 @@ 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
::
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
::
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"
);
}
};
...
...
@@ -57,29 +57,29 @@ 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
::
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"
);
fixed_point64
<
0
>
a1
(
0
);
fixed_point64
<
0
>
c1
=
a1
-
b
;
fixed_point64
<
0
>
d1
=
-
100
;
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
::
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
fixed_point32
<
0
>
a1
(
0
);
fixed_point32
<
0
>
c1
=
a1
-
b
;
fixed_point32
<
0
>
d1
=
-
100
;
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"
);
}
...
...
@@ -89,19 +89,19 @@ 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
::
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
::
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"
);
}
...
...
contracts/test_api/test_math.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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"
);
...
...
contracts/test_api/test_print.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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'
};
...
...
@@ -28,11 +29,11 @@ void test_print::test_prints() {
void
test_print
::
test_printi
()
{
printi
(
0
);
printi
(
556644
);
printi
(
-
1
);
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
);
...
...
contracts/test_api/test_real.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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"
);
}
...
...
contracts/test_api/test_transaction.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
&
d
a
)
{
ds
<<
d
a
.
a
;
ds
<<
d
a
.
b
;
ds
<<
d
a
.
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
&
d
a
)
{
ds
>>
d
a
.
a
;
ds
>>
d
a
.
b
;
ds
>>
d
a
.
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
;
uint
64
_t
read
=
read_transaction
(
(
char
*
)
&
t
,
sizeof
(
t
)
);
uint
32
_t
read
=
read_transaction
(
(
char
*
)
&
t
,
sizeof
(
t
)
);
sha256
(
p
,
read
,
&
h
);
printhex
(
&
h
,
sizeof
(
h
)
);
}
...
...
contracts/test_api/test_types.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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"
);
}
}
...
...
contracts/test_api_db/test_db.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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"
};
u
int32_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
,
""
);
in
t
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"
;
in
t
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
(
in
t
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
al
ice_ssn
=
265
,
al
lyson_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
());
...
...
contracts/test_api_mem/test_api_mem.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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");
...
...
contracts/test_api_mem/test_extended_memory.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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,7 +90,7 @@ void test_extended_memory::test_page_memory_exceeded() {
}
void
test_extended_memory
::
test_page_memory_negative_bytes
()
{
sbrk
(
-
1
);
sbrk
((
uint32_t
)
-
1
);
eosio_assert
(
0
,
"Should have thrown exception for trying to remove memory"
);
}
...
...
contracts/test_api_mem/test_memory.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
{
...
...
debian/CMakeLists.txt
0 → 100644
浏览文件 @
7ab4b6d5
set
(
CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/postinst"
PARENT_SCOPE
)
debian/postinst
0 → 100755
浏览文件 @
7ab4b6d5
#!/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
eosio_build.sh
浏览文件 @
7ab4b6d5
...
...
@@ -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
libraries/abi_generator/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -10,9 +10,9 @@ add_library( abi_generator
abi_generator.cpp
${
HEADERS
}
)
target_include_directories
(
abi_generator
target_include_directories
(
abi_generator
PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
"
${
LLVM_INCLUDE_DIRS
}
"
)
"
${
LLVM_INCLUDE_DIRS
}
"
)
target_link_libraries
(
abi_generator eosio_chain
clangRewrite
...
...
appbase
@
31a02293
比较
ef2b0c8d
...
31a02293
Subproject commit
ef2b0c8d64f770d80ce537ec04d0de4bdc4d3585
Subproject commit
31a02293a303782a97963a2e67815703f1123914
libraries/chain/chain_controller.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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_rep
i
titions
;
return
get_global_properties
().
active_producers
.
producers
.
size
()
*
config
::
producer_rep
e
titions
;
}
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_rep
i
titions
);
index
/=
config
::
producer_rep
i
titions
;
auto
index
=
current_aslot
%
(
number_of_active_producers
*
config
::
producer_rep
e
titions
);
index
/=
config
::
producer_rep
e
titions
;
FC_ASSERT
(
gpo
.
active_producers
.
producers
.
size
()
>
0
,
"no producers defined"
);
return
gpo
.
active_producers
.
producers
[
index
].
producer_name
;
...
...
libraries/chain/include/eosio/chain/config.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -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_rep
i
titions
=
12
;
const
static
int
producer_rep
e
titions
=
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_rep
i
titions;
//const static int blocks_per_round = producer_count * producer_rep
e
titions;
const
static
int
irreversible_threshold_percent
=
70
*
percent_1
;
...
...
libraries/chain/include/eosio/chain/softfloat.hpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
*
);
...
...
libraries/chain/wasm_interface.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
{
u
int64_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"
);
...
...
@@ -1209,6 +1209,105 @@ class compiler_builtins : public context_aware_api {
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
,
...
...
chainbase
@
4ebab558
比较
664fdd9e
...
4ebab558
Subproject commit
664fdd9e79263a894794f96959612ec2d1d013d0
Subproject commit
4ebab558f506f13457317fe9f0ca5b79511b76a1
libraries/fc/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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"
)
...
...
plugins/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
plugins/account_history_api_plugin/CMakeLists.txt
浏览文件 @
7ab4b6d5
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
}
)
...
...
plugins/chain_plugin/chain_plugin.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
<
b
oost
::
filesystem
::
path
>
(
),
"File to read Genesis State from"
)
(
"genesis-json"
,
bpo
::
value
<
b
fs
::
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
>
();
...
...
plugins/mongo_db_plugin/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
()
plugins/net_plugin/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
plugins/net_plugin/net_plugin.cpp
浏览文件 @
7ab4b6d5
plugins/template_plugin/template_plugin.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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:
...
...
plugins/txn_test_gen_plugin/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
plugins/wallet_plugin/wallet_plugin.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
())
{
}
...
...
programs/debug_node/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
programs/eosio-abigen/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
}
)
programs/eosio-applesedemo/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
programs/eosio-launcher/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
}
)
programs/eosio-launcher/main.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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 >s) {
}
eosdcmd
+=
"--data-dir "
+
instance
.
data_dir
;
eosdcmd
+=
" --config-dir "
+
instance
.
data_dir
;
if
(
gts
.
length
())
{
eosdcmd
+=
" --genesis-timestamp "
+
gts
;
}
...
...
programs/eosioc/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
}
)
programs/eosioc/main.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
());
...
...
programs/eosiod/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
programs/eosiod/main.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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"
...
...
@@ -75,14 +76,39 @@ void initialize_logging()
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
)
{
...
...
programs/eosiowd/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
}
)
programs/eosiowd/main.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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
;
...
...
scripts/CMakeLists.txt
浏览文件 @
7ab4b6d5
...
...
@@ -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
)
scripts/abi_is_json.py
0 → 100755
浏览文件 @
7ab4b6d5
#!/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
)
scripts/eosio_build_ubuntu.sh
浏览文件 @
7ab4b6d5
...
...
@@ -24,11 +24,22 @@
exit
1
fi
case
$OS_NAME
in
"Linux Mint"
)
if
[
$OS_MAJ
-lt
18
]
;
then
printf
"
\t
You must be running Linux Mint 18.x or higher to install EOSIO.
\n
"
printf
"
\t
Exiting now.
\n
"
exit
1
fi
;;
"Ubuntu"
)
if
[
$OS_MIN
-lt
4
]
;
then
printf
"
\t
You must be running Ubuntu 16.04.x or higher to install EOSIO.
\n
"
printf
"
\t
Exiting now.
\n
"
exit
1
fi
;;
esac
if
[
$DISK_AVAIL
-lt
$DISK_MIN
]
;
then
printf
"
\t
You must have at least
${
DISK_MIN
}
GB of available storage to install EOSIO.
\n
"
...
...
tests/eosiod_run_test.py
浏览文件 @
7ab4b6d5
...
...
@@ -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"
...
...
tests/testUtils.py
浏览文件 @
7ab4b6d5
...
...
@@ -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
oe
sio.system."
)
Utils
.
errorExit
(
"Failed to publish
eo
sio.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
:
...
...
@@ -961,8 +983,8 @@ class WalletMgr(object):
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
)
...
...
@@ -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."
)
...
...
@@ -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
))
...
...
tests/tests/database_tests.cpp
浏览文件 @
7ab4b6d5
...
...
@@ -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_rep
i
titions
;
const
auto
current_round
=
head_block_num
/
config
::
producer_rep
e
titions
;
const
auto
irreversible_round
=
current_round
-
max_reversible_rounds
;
return
(
irreversible_round
+
1
)
*
config
::
producer_rep
i
titions
-
1
;
return
(
irreversible_round
+
1
)
*
config
::
producer_rep
e
titions
-
1
;
}
};
...
...
tools/CMakeLists.txt
浏览文件 @
7ab4b6d5
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
}
)
tools/eosiocpp.in
浏览文件 @
7ab4b6d5
#!/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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录