Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
c6cff96d
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,发现更多精彩内容 >>
提交
c6cff96d
编写于
9月 06, 2017
作者:
D
Daniel Larimer
提交者:
GitHub
9月 06, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #361 from EOSIO/nathan-misc
Updates for SDK
上级
85a1607a
ee984184
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
110 addition
and
7 deletion
+110
-7
libraries/chainbase
libraries/chainbase
+1
-1
libraries/fc/CMakeLists.txt
libraries/fc/CMakeLists.txt
+9
-2
libraries/types/CMakeLists.txt
libraries/types/CMakeLists.txt
+7
-0
libraries/utilities/CMakeLists.txt
libraries/utilities/CMakeLists.txt
+4
-2
libraries/utilities/include/eos/utilities/wasm.hpp
libraries/utilities/include/eos/utilities/wasm.hpp
+8
-0
libraries/utilities/wasm.cpp
libraries/utilities/wasm.cpp
+48
-0
tests/common/database_fixture.hpp
tests/common/database_fixture.hpp
+9
-2
tests/common/macro_support.hpp
tests/common/macro_support.hpp
+12
-0
tests/common/testing_macros.hpp
tests/common/testing_macros.hpp
+12
-0
未找到文件。
chainbase
@
b7e07526
比较
d48ebabf
...
b7e07526
Subproject commit
d48ebabf56b4115753fcabb7648a0ffcf3b0f5e9
Subproject commit
b7e07526feec60f887b7579ad9cae78999940fd7
libraries/fc/CMakeLists.txt
浏览文件 @
c6cff96d
...
...
@@ -2,7 +2,7 @@
#INCLUDE(GetPrerequisites)
#INCLUDE(VersionMacros)
SET
(
DEFAULT_HEADER_INSTALL_DIR include/
\
${
target
}
)
SET
(
DEFAULT_HEADER_INSTALL_DIR include/
${
target
}
)
SET
(
DEFAULT_LIBRARY_INSTALL_DIR lib/
)
SET
(
DEFAULT_EXECUTABLE_INSTALL_DIR bin/
)
SET
(
CMAKE_DEBUG_POSTFIX _debug
)
...
...
@@ -112,8 +112,15 @@ set( sources
#list(APPEND sources "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp")
list
(
APPEND sources
${
fc_headers
}
)
setup_library
(
fc SOURCES
${
sources
}
LIBRARY_TYPE STATIC
DONT_INSTALL_LIBRARY
)
setup_library
(
fc SOURCES
${
sources
}
LIBRARY_TYPE STATIC
)
INSTALL
(
TARGETS fc
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
INSTALL
(
DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/include DESTINATION .
)
IF
(
APPLE
)
# As of 10.10 yosemite, the OpenSSL static libraries shipped with os x have a dependency
# on zlib, so any time you link in openssl you also need to link zlib. . We really want to detect whether openssl was configured with the --no-zlib
...
...
libraries/types/CMakeLists.txt
浏览文件 @
c6cff96d
...
...
@@ -20,4 +20,11 @@ target_link_libraries( type_generator eos_utilities fc ${CMAKE_DL_LIBS} ${PLATFO
add_custom_command
(
OUTPUT
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/eos/types/generated.hpp"
COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/type_generator
${
CMAKE_CURRENT_SOURCE_DIR
}
/types.eos
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/eos/types/generated.hpp
DEPENDS types.eos type_generator
)
INSTALL
(
TARGETS
eos_types
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION
"include/eos/types"
)
libraries/utilities/CMakeLists.txt
浏览文件 @
c6cff96d
...
...
@@ -14,6 +14,7 @@ set(sources
string_escape.cpp
tempdir.cpp
words.cpp
wasm.cpp
${
HEADERS
}
)
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/git_revision.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp" @ONLY)
...
...
@@ -22,9 +23,10 @@ set(sources
add_library
(
eos_utilities
${
sources
}
${
HEADERS
}
)
target_link_libraries
(
eos_utilities fc
)
target_link_libraries
(
eos_utilities fc
WAST WASM
)
target_include_directories
(
eos_utilities
PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
)
PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../wasm-jit/Include"
)
if
(
USE_PCH
)
set_target_properties
(
eos_utilities PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE
)
cotire
(
eos_utilities
)
...
...
libraries/utilities/include/eos/utilities/wasm.hpp
0 → 100644
浏览文件 @
c6cff96d
#pragma once
#include <string>
#include <vector>
namespace
eos
{
namespace
utilities
{
std
::
vector
<
uint8_t
>
assemble_wast
(
const
std
::
string
&
wast
);
}
}
// namespace eos::utilities
libraries/utilities/wasm.cpp
0 → 100644
浏览文件 @
c6cff96d
#include <eos/utilities/wasm.hpp>
#include <fc/exception/exception.hpp>
#include <Inline/BasicTypes.h>
#include <IR/Module.h>
#include <IR/Validate.h>
#include <WAST/WAST.h>
#include <WASM/WASM.h>
#include <iostream>
#include <iomanip>
namespace
eos
{
namespace
utilities
{
std
::
vector
<
uint8_t
>
assemble_wast
(
const
std
::
string
&
wast
)
{
IR
::
Module
module
;
std
::
vector
<
WAST
::
Error
>
parseErrors
;
WAST
::
parseModule
(
wast
.
c_str
(),
wast
.
size
(),
module
,
parseErrors
);
if
(
parseErrors
.
size
())
{
// Print any parse errors;
std
::
cerr
<<
"Error parsing WebAssembly text file:"
<<
std
::
endl
;
for
(
auto
&
error
:
parseErrors
)
{
std
::
cerr
<<
":"
<<
error
.
locus
.
describe
()
<<
": "
<<
error
.
message
.
c_str
()
<<
std
::
endl
;
std
::
cerr
<<
error
.
locus
.
sourceLine
<<
std
::
endl
;
std
::
cerr
<<
std
::
setw
(
error
.
locus
.
column
(
8
))
<<
"^"
<<
std
::
endl
;
}
FC_ASSERT
(
!
"error parsing wast"
);
}
try
{
// Serialize the WebAssembly module.
Serialization
::
ArrayOutputStream
stream
;
WASM
::
serialize
(
stream
,
module
);
return
stream
.
getBytes
();
}
catch
(
Serialization
::
FatalSerializationException
exception
)
{
std
::
cerr
<<
"Error serializing WebAssembly binary file:"
<<
std
::
endl
;
std
::
cerr
<<
exception
.
message
<<
std
::
endl
;
throw
;
}
}
}
}
// namespace eos::utilities
tests/common/database_fixture.hpp
浏览文件 @
c6cff96d
...
...
@@ -142,15 +142,22 @@ protected:
*/
class
testing_blockchain
:
public
chain_controller
{
public:
testing_blockchain
(
chainbase
::
database
&
db
,
fork_database
&
fork_db
,
block_log
&
blocklog
,
testing_blockchain
(
chainbase
::
database
&
db
,
fork_database
&
fork_db
,
block_log
&
blocklog
,
chain_initializer_interface
&
initializer
,
testing_fixture
&
fixture
);
/**
* @brief Publish the provided contract to the blockchain, owned by owner
* @param owner The account to publish the contract under
* @param contract_wast The WAST of the contract
*/
void
set_contract
(
AccountName
owner
,
const
char
*
contract_wast
);
/**
* @brief Produce new blocks, adding them to the blockchain, optionally following a gap of missed blocks
* @param count Number of blocks to produce
* @param blocks_to_miss Number of block intervals to miss a production before producing the next block
*
* Creates and adds
@ref count new blocks to the blockchain, after going @ref blocks_to_miss intervals without
* Creates and adds @ref count new blocks to the blockchain, after going @ref blocks_to_miss intervals without
* producing a block.
*/
void
produce_blocks
(
uint32_t
count
=
1
,
uint32_t
blocks_to_miss
=
0
);
...
...
tests/common/macro_support.hpp
浏览文件 @
c6cff96d
...
...
@@ -74,6 +74,18 @@ inline std::vector<Name> sort_names( std::vector<Name>&& names ) {
#define MKACCT7(chain, name, creator, deposit, owner, active, recovery) \
MKACCT_IMPL(chain, name, creator, owner, active, recovery, deposit)
#define SETCODE3(chain, acct, wast) \
{ \
auto wasm = eos::utilities::assemble_wast(wast); \
types::setcode handler; \
handler.account = #acct; \
handler.code.assign(wasm.begin(), wasm.end()); \
eos::chain::SignedTransaction trx; \
trx.scope = sort_names({config::EosContractName, #acct}); \
transaction_emplace_message(trx, config::EosContractName, vector<types::AccountPermission>{{#acct,"active"}}, \
"setcode", handler); \
}
#define SETAUTH5(chain, account, authname, parentname, auth) \
{ \
eos::chain::SignedTransaction trx; \
...
...
tests/common/testing_macros.hpp
浏览文件 @
c6cff96d
#pragma once
#include <eos/utilities/wasm.hpp>
#include "macro_support.hpp"
/// Some helpful macros to reduce boilerplate when making testcases
...
...
@@ -170,6 +172,16 @@
*/
#define Make_Account(...) BOOST_PP_OVERLOAD(MKACCT, __VA_ARGS__)(__VA_ARGS__)
/**
* @brief Shorthand way to set the code for an account
*
* @code{.cpp}
* char* wast = //...
* Set_Code(chain, codeacct, wast);
* @endcode
*/
#define Set_Code(...) BOOST_PP_OVERLOAD(SETCODE, __VA_ARGS__)(__VA_ARGS__)
/**
* @brief Shorthand way to create or update named authority on an account
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录