Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
93026fb1
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,发现更多精彩内容 >>
提交
93026fb1
编写于
2月 14, 2018
作者:
A
Anton Perkov
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into contracts-use-new-dbapi
上级
73f01c55
27b89b2d
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
71 addition
and
81 deletion
+71
-81
libraries/chain/contracts/abi_serializer.cpp
libraries/chain/contracts/abi_serializer.cpp
+0
-11
libraries/chain/contracts/chain_initializer.cpp
libraries/chain/contracts/chain_initializer.cpp
+2
-2
libraries/chain/contracts/eosio_contract.cpp
libraries/chain/contracts/eosio_contract.cpp
+7
-2
libraries/chain/include/eosio/chain/contracts/abi_serializer.hpp
...es/chain/include/eosio/chain/contracts/abi_serializer.hpp
+2
-4
libraries/chain/include/eosio/chain/contracts/chain_initializer.hpp
...chain/include/eosio/chain/contracts/chain_initializer.hpp
+1
-1
libraries/testing/include/eosio/testing/tester.hpp
libraries/testing/include/eosio/testing/tester.hpp
+1
-1
plugins/account_history_plugin/account_history_plugin.cpp
plugins/account_history_plugin/account_history_plugin.cpp
+1
-1
plugins/chain_plugin/chain_plugin.cpp
plugins/chain_plugin/chain_plugin.cpp
+5
-5
plugins/mongo_db_plugin/mongo_db_plugin.cpp
plugins/mongo_db_plugin/mongo_db_plugin.cpp
+19
-26
tests/CMakeLists.txt
tests/CMakeLists.txt
+4
-3
tests/eosiod_run_test.py
tests/eosiod_run_test.py
+4
-5
tests/testUtils.py
tests/testUtils.py
+9
-4
tests/tests/abi_tests.cpp
tests/tests/abi_tests.cpp
+10
-10
tests/wasm_tests/identity_tests.cpp
tests/wasm_tests/identity_tests.cpp
+2
-2
tests/wasm_tests/wasm_tests.cpp
tests/wasm_tests/wasm_tests.cpp
+4
-4
未找到文件。
libraries/chain/contracts/abi_serializer.cpp
浏览文件 @
93026fb1
...
@@ -131,17 +131,6 @@ namespace eosio { namespace chain { namespace contracts {
...
@@ -131,17 +131,6 @@ namespace eosio { namespace chain { namespace contracts {
FC_ASSERT
(
tables
.
size
()
==
abi
.
tables
.
size
()
);
FC_ASSERT
(
tables
.
size
()
==
abi
.
tables
.
size
()
);
}
}
void
abi_serializer
::
append_system_abi
(
account_name
account
,
abi_def
&
abi
)
{
if
(
account
==
eosio
::
chain
::
config
::
system_account_name
)
{
abi_def
eos_abi
=
chain_initializer
::
eos_contract_abi
();
abi
.
actions
.
insert
(
abi
.
actions
.
end
(),
eos_abi
.
actions
.
cbegin
(),
eos_abi
.
actions
.
cend
());
abi
.
structs
.
insert
(
abi
.
structs
.
end
(),
eos_abi
.
structs
.
cbegin
(),
eos_abi
.
structs
.
cend
());
abi
.
tables
.
insert
(
abi
.
tables
.
end
(),
eos_abi
.
tables
.
cbegin
(),
eos_abi
.
tables
.
cend
());
abi
.
types
.
insert
(
abi
.
types
.
end
(),
eos_abi
.
types
.
cbegin
(),
eos_abi
.
types
.
cend
());
}
}
bool
abi_serializer
::
is_builtin_type
(
const
type_name
&
type
)
const
{
bool
abi_serializer
::
is_builtin_type
(
const
type_name
&
type
)
const
{
return
built_in_types
.
find
(
type
)
!=
built_in_types
.
end
();
return
built_in_types
.
find
(
type
)
!=
built_in_types
.
end
();
}
}
...
...
libraries/chain/contracts/chain_initializer.cpp
浏览文件 @
93026fb1
...
@@ -50,9 +50,9 @@ void chain_initializer::register_types(chain_controller& chain, chainbase::datab
...
@@ -50,9 +50,9 @@ void chain_initializer::register_types(chain_controller& chain, chainbase::datab
}
}
abi_def
chain_initializer
::
eos_contract_abi
()
abi_def
chain_initializer
::
eos_contract_abi
(
const
abi_def
&
eosio_system_abi
)
{
{
abi_def
eos_abi
;
abi_def
eos_abi
(
eosio_system_abi
)
;
eos_abi
.
types
.
push_back
(
type_def
{
"account_name"
,
"name"
}
);
eos_abi
.
types
.
push_back
(
type_def
{
"account_name"
,
"name"
}
);
eos_abi
.
types
.
push_back
(
type_def
{
"share_type"
,
"int64"
}
);
eos_abi
.
types
.
push_back
(
type_def
{
"share_type"
,
"int64"
}
);
eos_abi
.
types
.
push_back
(
type_def
{
"onerror"
,
"bytes"
}
);
eos_abi
.
types
.
push_back
(
type_def
{
"onerror"
,
"bytes"
}
);
...
...
libraries/chain/contracts/eosio_contract.cpp
浏览文件 @
93026fb1
...
@@ -142,10 +142,15 @@ void apply_eosio_setabi(apply_context& context) {
...
@@ -142,10 +142,15 @@ void apply_eosio_setabi(apply_context& context) {
context
.
require_authorization
(
act
.
account
);
context
.
require_authorization
(
act
.
account
);
// if system account append native abi
if
(
act
.
account
==
eosio
::
chain
::
config
::
system_account_name
)
{
act
.
abi
=
chain_initializer
::
eos_contract_abi
(
act
.
abi
);
}
/// if an ABI is specified make sure it is well formed and doesn't
/// if an ABI is specified make sure it is well formed and doesn't
/// reference any undefined types
/// reference any undefined types
abi_serializer
(
act
.
abi
).
validate
();
abi_serializer
(
act
.
abi
).
validate
();
// todo: figure out abi serilization location
// todo: figure out abi seri
a
lization location
const
auto
&
account
=
db
.
get
<
account_object
,
by_name
>
(
act
.
account
);
const
auto
&
account
=
db
.
get
<
account_object
,
by_name
>
(
act
.
account
);
db
.
modify
(
account
,
[
&
](
auto
&
a
)
{
db
.
modify
(
account
,
[
&
](
auto
&
a
)
{
...
@@ -306,7 +311,7 @@ void apply_eosio_onerror(apply_context& context) {
...
@@ -306,7 +311,7 @@ void apply_eosio_onerror(apply_context& context) {
static
const
abi_serializer
&
get_abi_serializer
()
{
static
const
abi_serializer
&
get_abi_serializer
()
{
static
optional
<
abi_serializer
>
_abi_serializer
;
static
optional
<
abi_serializer
>
_abi_serializer
;
if
(
!
_abi_serializer
)
{
if
(
!
_abi_serializer
)
{
_abi_serializer
.
emplace
(
chain_initializer
::
eos_contract_abi
());
_abi_serializer
.
emplace
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
}
}
return
*
_abi_serializer
;
return
*
_abi_serializer
;
...
...
libraries/chain/include/eosio/chain/contracts/abi_serializer.hpp
浏览文件 @
93026fb1
...
@@ -73,12 +73,11 @@ struct abi_serializer {
...
@@ -73,12 +73,11 @@ struct abi_serializer {
}
}
template
<
typename
Vec
>
template
<
typename
Vec
>
static
bool
to_abi
(
account_name
account
,
const
Vec
&
abi_vec
,
abi_def
&
abi
)
static
bool
to_abi
(
const
Vec
&
abi_vec
,
abi_def
&
abi
)
{
{
if
(
!
is_empty_abi
(
abi_vec
)
||
account
==
eosio
::
chain
::
config
::
system_account_name
)
{
/// 4 == packsize of empty Abi
if
(
!
is_empty_abi
(
abi_vec
)
)
{
/// 4 == packsize of empty Abi
fc
::
datastream
<
const
char
*>
ds
(
abi_vec
.
data
(),
abi_vec
.
size
()
);
fc
::
datastream
<
const
char
*>
ds
(
abi_vec
.
data
(),
abi_vec
.
size
()
);
fc
::
raw
::
unpack
(
ds
,
abi
);
fc
::
raw
::
unpack
(
ds
,
abi
);
append_system_abi
(
account
,
abi
);
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -86,7 +85,6 @@ struct abi_serializer {
...
@@ -86,7 +85,6 @@ struct abi_serializer {
private:
private:
void
binary_to_variant
(
const
type_name
&
type
,
fc
::
datastream
<
const
char
*>&
stream
,
fc
::
mutable_variant_object
&
obj
)
const
;
void
binary_to_variant
(
const
type_name
&
type
,
fc
::
datastream
<
const
char
*>&
stream
,
fc
::
mutable_variant_object
&
obj
)
const
;
static
void
append_system_abi
(
account_name
account
,
abi_def
&
abi
);
};
};
namespace
impl
{
namespace
impl
{
...
...
libraries/chain/include/eosio/chain/contracts/chain_initializer.hpp
浏览文件 @
93026fb1
...
@@ -24,7 +24,7 @@ namespace eosio { namespace chain { namespace contracts {
...
@@ -24,7 +24,7 @@ namespace eosio { namespace chain { namespace contracts {
void
prepare_database
(
chain
::
chain_controller
&
chain
,
chainbase
::
database
&
db
);
void
prepare_database
(
chain
::
chain_controller
&
chain
,
chainbase
::
database
&
db
);
static
abi_def
eos_contract_abi
();
static
abi_def
eos_contract_abi
(
const
abi_def
&
eosio_system_abi
);
private:
private:
genesis_state_type
genesis
;
genesis_state_type
genesis
;
...
...
libraries/testing/include/eosio/testing/tester.hpp
浏览文件 @
93026fb1
...
@@ -85,7 +85,7 @@ namespace eosio { namespace testing {
...
@@ -85,7 +85,7 @@ namespace eosio { namespace testing {
try
{
try
{
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
name
);
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
name
);
contracts
::
abi_def
abi
;
contracts
::
abi_def
abi
;
if
(
contracts
::
abi_serializer
::
to_abi
(
accnt
.
name
,
accnt
.
abi
,
abi
))
{
if
(
contracts
::
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
))
{
return
contracts
::
abi_serializer
(
abi
);
return
contracts
::
abi_serializer
(
abi
);
}
}
return
optional
<
contracts
::
abi_serializer
>
();
return
optional
<
contracts
::
abi_serializer
>
();
...
...
plugins/account_history_plugin/account_history_plugin.cpp
浏览文件 @
93026fb1
...
@@ -413,7 +413,7 @@ fc::variant account_history_plugin_impl::transaction_to_variant(const packed_tra
...
@@ -413,7 +413,7 @@ fc::variant account_history_plugin_impl::transaction_to_variant(const packed_tra
const
auto
*
accnt
=
database
.
find
<
chain
::
account_object
,
chain
::
by_name
>
(
name
);
const
auto
*
accnt
=
database
.
find
<
chain
::
account_object
,
chain
::
by_name
>
(
name
);
if
(
accnt
!=
nullptr
)
{
if
(
accnt
!=
nullptr
)
{
abi_def
abi
;
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
accnt
->
name
,
accnt
->
abi
,
abi
))
{
if
(
abi_serializer
::
to_abi
(
accnt
->
abi
,
abi
))
{
return
abi_serializer
(
abi
);
return
abi_serializer
(
abi
);
}
}
}
}
...
...
plugins/chain_plugin/chain_plugin.cpp
浏览文件 @
93026fb1
...
@@ -284,7 +284,7 @@ abi_def get_abi( const chain_controller& db, const name& account ) {
...
@@ -284,7 +284,7 @@ abi_def get_abi( const chain_controller& db, const name& account ) {
const
auto
&
code_accnt
=
d
.
get
<
account_object
,
by_name
>
(
account
);
const
auto
&
code_accnt
=
d
.
get
<
account_object
,
by_name
>
(
account
);
abi_def
abi
;
abi_def
abi
;
abi_serializer
::
to_abi
(
code_accnt
.
name
,
code_accnt
.
abi
,
abi
);
abi_serializer
::
to_abi
(
code_accnt
.
abi
,
abi
);
return
abi
;
return
abi
;
}
}
...
@@ -365,7 +365,7 @@ struct resolver_factory {
...
@@ -365,7 +365,7 @@ struct resolver_factory {
const
auto
*
accnt
=
api
->
db
.
get_database
().
template
find
<
account_object
,
by_name
>(
name
);
const
auto
*
accnt
=
api
->
db
.
get_database
().
template
find
<
account_object
,
by_name
>(
name
);
if
(
accnt
!=
nullptr
)
{
if
(
accnt
!=
nullptr
)
{
abi_def
abi
;
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
accnt
->
name
,
accnt
->
abi
,
abi
))
{
if
(
abi_serializer
::
to_abi
(
accnt
->
abi
,
abi
))
{
return
abi_serializer
(
abi
);
return
abi_serializer
(
abi
);
}
}
}
}
...
@@ -450,7 +450,7 @@ read_only::get_code_results read_only::get_code( const get_code_params& params )
...
@@ -450,7 +450,7 @@ read_only::get_code_results read_only::get_code( const get_code_params& params )
}
}
abi_def
abi
;
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
accnt
.
name
,
accnt
.
abi
,
abi
)
)
{
if
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
)
)
{
result
.
abi
=
std
::
move
(
abi
);
result
.
abi
=
std
::
move
(
abi
);
}
}
...
@@ -492,7 +492,7 @@ read_only::abi_json_to_bin_result read_only::abi_json_to_bin( const read_only::a
...
@@ -492,7 +492,7 @@ read_only::abi_json_to_bin_result read_only::abi_json_to_bin( const read_only::a
abi_json_to_bin_result
result
;
abi_json_to_bin_result
result
;
const
auto
&
code_account
=
db
.
get_database
().
get
<
account_object
,
by_name
>
(
params
.
code
);
const
auto
&
code_account
=
db
.
get_database
().
get
<
account_object
,
by_name
>
(
params
.
code
);
abi_def
abi
;
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
code_account
.
name
,
code_account
.
abi
,
abi
)
)
{
if
(
abi_serializer
::
to_abi
(
code_account
.
abi
,
abi
)
)
{
abi_serializer
abis
(
abi
);
abi_serializer
abis
(
abi
);
result
.
binargs
=
abis
.
variant_to_binary
(
abis
.
get_action_type
(
params
.
action
),
params
.
args
);
result
.
binargs
=
abis
.
variant_to_binary
(
abis
.
get_action_type
(
params
.
action
),
params
.
args
);
}
}
...
@@ -503,7 +503,7 @@ read_only::abi_bin_to_json_result read_only::abi_bin_to_json( const read_only::a
...
@@ -503,7 +503,7 @@ read_only::abi_bin_to_json_result read_only::abi_bin_to_json( const read_only::a
abi_bin_to_json_result
result
;
abi_bin_to_json_result
result
;
const
auto
&
code_account
=
db
.
get_database
().
get
<
account_object
,
by_name
>
(
params
.
code
);
const
auto
&
code_account
=
db
.
get_database
().
get
<
account_object
,
by_name
>
(
params
.
code
);
abi_def
abi
;
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
code_account
.
name
,
code_account
.
abi
,
abi
)
)
{
if
(
abi_serializer
::
to_abi
(
code_account
.
abi
,
abi
)
)
{
abi_serializer
abis
(
abi
);
abi_serializer
abis
(
abi
);
result
.
args
=
abis
.
binary_to_variant
(
abis
.
get_action_type
(
params
.
action
),
params
.
binargs
);
result
.
args
=
abis
.
binary_to_variant
(
abis
.
get_action_type
(
params
.
action
),
params
.
binargs
);
}
}
...
...
plugins/mongo_db_plugin/mongo_db_plugin.cpp
浏览文件 @
93026fb1
...
@@ -73,7 +73,6 @@ public:
...
@@ -73,7 +73,6 @@ public:
void
consum_blocks
();
void
consum_blocks
();
bool
is_scope_relevant
(
const
vector
<
account_name
>&
scope
);
void
update_account
(
const
chain
::
action
&
msg
);
void
update_account
(
const
chain
::
action
&
msg
);
static
const
account_name
newaccount
;
static
const
account_name
newaccount
;
...
@@ -90,8 +89,6 @@ public:
...
@@ -90,8 +89,6 @@ public:
static
const
std
::
string
accounts_col
;
static
const
std
::
string
accounts_col
;
};
};
abi_def
mongo_db_plugin_impl
::
eos_abi
;
const
account_name
mongo_db_plugin_impl
::
newaccount
=
"newaccount"
;
const
account_name
mongo_db_plugin_impl
::
newaccount
=
"newaccount"
;
const
account_name
mongo_db_plugin_impl
::
transfer
=
"transfer"
;
const
account_name
mongo_db_plugin_impl
::
transfer
=
"transfer"
;
const
account_name
mongo_db_plugin_impl
::
lock
=
"lock"
;
const
account_name
mongo_db_plugin_impl
::
lock
=
"lock"
;
...
@@ -181,14 +178,13 @@ namespace {
...
@@ -181,14 +178,13 @@ namespace {
{
{
using
bsoncxx
::
builder
::
basic
::
kvp
;
using
bsoncxx
::
builder
::
basic
::
kvp
;
try
{
try
{
auto
from_account
=
find_account
(
accounts
,
msg
.
account
);
auto
abi
=
fc
::
json
::
from_string
(
bsoncxx
::
to_json
(
from_account
.
view
()[
"abi"
].
get_document
())).
as
<
abi_def
>
();
abi_serializer
abis
;
abi_serializer
abis
;
if
(
msg
.
account
==
chain
::
config
::
system_account_name
)
{
if
(
msg
.
account
==
chain
::
config
::
system_account_name
)
{
abis
.
set_abi
(
mongo_db_plugin_impl
::
eos_abi
);
abi
=
chain
::
contracts
::
chain_initializer
::
eos_contract_abi
(
abi
);
}
else
{
auto
from_account
=
find_account
(
accounts
,
msg
.
account
);
auto
abi
=
fc
::
json
::
from_string
(
bsoncxx
::
to_json
(
from_account
.
view
()[
"abi"
].
get_document
())).
as
<
abi_def
>
();
abis
.
set_abi
(
abi
);
}
}
abis
.
set_abi
(
abi
);
auto
v
=
abis
.
binary_to_variant
(
abis
.
get_action_type
(
msg
.
name
),
msg
.
data
);
auto
v
=
abis
.
binary_to_variant
(
abis
.
get_action_type
(
msg
.
name
),
msg
.
data
);
auto
json
=
fc
::
json
::
to_string
(
v
);
auto
json
=
fc
::
json
::
to_string
(
v
);
try
{
try
{
...
@@ -264,15 +260,10 @@ void mongo_db_plugin_impl::_process_irreversible_block(const signed_block& block
...
@@ -264,15 +260,10 @@ void mongo_db_plugin_impl::_process_irreversible_block(const signed_block& block
auto
block_num
=
block
.
block_num
();
auto
block_num
=
block
.
block_num
();
if
(
processed
==
0
)
{
if
(
processed
==
0
)
{
if
(
startup
)
{
if
(
wipe_database_on_
startup
)
{
// verify on start we have no previous blocks
// verify on start we have no previous blocks
verify_no_blocks
(
blocks
);
verify_no_blocks
(
blocks
);
FC_ASSERT
(
block_num
<
2
,
"Expected start of block, instead received block_num: ${bn}"
,
(
"bn"
,
block_num
));
FC_ASSERT
(
block_num
<
2
,
"Expected start of block, instead received block_num: ${bn}"
,
(
"bn"
,
block_num
));
// Currently we are creating a 'fake' block in chain_controller::initialize_chain() since initial accounts
// and producers are not written to the block log. If this is the fake block, indicate it as block_num 0.
if
(
block_num
==
1
&&
block
.
producer
==
chain
::
config
::
system_account_name
)
{
block_num
=
0
;
}
}
else
{
}
else
{
// verify on restart we have previous block
// verify on restart we have previous block
verify_last_block
(
blocks
,
prev_block_id_str
);
verify_last_block
(
blocks
,
prev_block_id_str
);
...
@@ -403,17 +394,22 @@ void mongo_db_plugin_impl::update_account(const chain::action& msg) {
...
@@ -403,17 +394,22 @@ void mongo_db_plugin_impl::update_account(const chain::action& msg) {
if
(
msg
.
name
==
transfer
)
{
if
(
msg
.
name
==
transfer
)
{
auto
now
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
auto
now
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
microseconds
{
fc
::
time_point
::
now
().
time_since_epoch
().
count
()});
std
::
chrono
::
microseconds
{
fc
::
time_point
::
now
().
time_since_epoch
().
count
()});
/* todo need to follow eosio.system transfer
auto transfer = msg.as<chain::contracts::transfer>();
abi_serializer
abis
;
auto from_name = transfer.from.to_string();
auto
eosio_account
=
find_account
(
accounts
,
msg
.
account
);
auto to_name = transfer.to.to_string();
auto
abi
=
fc
::
json
::
from_string
(
bsoncxx
::
to_json
(
eosio_account
.
view
()[
"abi"
].
get_document
())).
as
<
abi_def
>
();
auto from_account = find_account(accounts, transfer.from);
abis
.
set_abi
(
abi
);
auto to_account = find_account(accounts, transfer.to);
auto
transfer
=
abis
.
binary_to_variant
(
abis
.
get_action_type
(
msg
.
name
),
msg
.
data
);
auto
from_name
=
transfer
[
"from"
].
as
<
name
>
().
to_string
();
auto
to_name
=
transfer
[
"to"
].
as
<
name
>
().
to_string
();
auto
from_account
=
find_account
(
accounts
,
from_name
);
auto
to_account
=
find_account
(
accounts
,
to_name
);
asset
from_balance
=
asset
::
from_string
(
from_account
.
view
()[
"eos_balance"
].
get_utf8
().
value
.
to_string
());
asset
from_balance
=
asset
::
from_string
(
from_account
.
view
()[
"eos_balance"
].
get_utf8
().
value
.
to_string
());
asset
to_balance
=
asset
::
from_string
(
to_account
.
view
()[
"eos_balance"
].
get_utf8
().
value
.
to_string
());
asset
to_balance
=
asset
::
from_string
(
to_account
.
view
()[
"eos_balance"
].
get_utf8
().
value
.
to_string
());
from_balance -= asset(chain::share_type(transfer.amount));
auto
asset_quantity
=
transfer
[
"quantity"
].
as
<
asset
>
();
to_balance += asset(chain::share_type(transfer.amount));
from_balance
-=
asset_quantity
;
to_balance
+=
asset_quantity
;
document
update_from
{};
document
update_from
{};
update_from
<<
"$set"
<<
open_document
<<
"eos_balance"
<<
from_balance
.
to_string
()
update_from
<<
"$set"
<<
open_document
<<
"eos_balance"
<<
from_balance
.
to_string
()
...
@@ -426,7 +422,7 @@ void mongo_db_plugin_impl::update_account(const chain::action& msg) {
...
@@ -426,7 +422,7 @@ void mongo_db_plugin_impl::update_account(const chain::action& msg) {
accounts
.
update_one
(
document
{}
<<
"_id"
<<
from_account
.
view
()[
"_id"
].
get_oid
()
<<
finalize
,
update_from
.
view
());
accounts
.
update_one
(
document
{}
<<
"_id"
<<
from_account
.
view
()[
"_id"
].
get_oid
()
<<
finalize
,
update_from
.
view
());
accounts
.
update_one
(
document
{}
<<
"_id"
<<
to_account
.
view
()[
"_id"
].
get_oid
()
<<
finalize
,
update_to
.
view
());
accounts
.
update_one
(
document
{}
<<
"_id"
<<
to_account
.
view
()[
"_id"
].
get_oid
()
<<
finalize
,
update_to
.
view
());
*/
}
else
if
(
msg
.
name
==
newaccount
)
{
}
else
if
(
msg
.
name
==
newaccount
)
{
auto
now
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
auto
now
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
microseconds
{
fc
::
time_point
::
now
().
time_since_epoch
().
count
()});
std
::
chrono
::
microseconds
{
fc
::
time_point
::
now
().
time_since_epoch
().
count
()});
...
@@ -496,8 +492,6 @@ void mongo_db_plugin_impl::init() {
...
@@ -496,8 +492,6 @@ void mongo_db_plugin_impl::init() {
// Create the native contract accounts manually; sadly, we can't run their contracts to make them create themselves
// Create the native contract accounts manually; sadly, we can't run their contracts to make them create themselves
// See native_contract_chain_initializer::prepare_database()
// See native_contract_chain_initializer::prepare_database()
eos_abi
=
chain
::
contracts
::
chain_initializer
::
eos_contract_abi
();
accounts
=
mongo_conn
[
db_name
][
accounts_col
];
// Accounts
accounts
=
mongo_conn
[
db_name
][
accounts_col
];
// Accounts
bsoncxx
::
builder
::
stream
::
document
doc
{};
bsoncxx
::
builder
::
stream
::
document
doc
{};
if
(
accounts
.
count
(
doc
.
view
())
==
0
)
{
if
(
accounts
.
count
(
doc
.
view
())
==
0
)
{
...
@@ -507,7 +501,6 @@ void mongo_db_plugin_impl::init() {
...
@@ -507,7 +501,6 @@ void mongo_db_plugin_impl::init() {
<<
"eos_balance"
<<
asset
(
chain
::
config
::
initial_token_supply
).
to_string
()
<<
"eos_balance"
<<
asset
(
chain
::
config
::
initial_token_supply
).
to_string
()
<<
"staked_balance"
<<
asset
().
to_string
()
<<
"staked_balance"
<<
asset
().
to_string
()
<<
"unstaking_balance"
<<
asset
().
to_string
()
<<
"unstaking_balance"
<<
asset
().
to_string
()
<<
"abi"
<<
bsoncxx
::
from_json
(
fc
::
json
::
to_string
(
eos_abi
))
<<
"createdAt"
<<
b_date
{
now
}
<<
"createdAt"
<<
b_date
{
now
}
<<
"updatedAt"
<<
b_date
{
now
};
<<
"updatedAt"
<<
b_date
{
now
};
...
...
tests/CMakeLists.txt
浏览文件 @
93026fb1
...
@@ -74,13 +74,14 @@ add_test(chain_test chain_test --report_level=detailed)
...
@@ -74,13 +74,14 @@ add_test(chain_test chain_test --report_level=detailed)
add_test
(
NAME eosiod_run_test COMMAND tests/eosiod_run_test.py -v --dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_test
(
NAME eosiod_run_test COMMAND tests/eosiod_run_test.py -v --dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_test
(
NAME eosiod_run_remote_test COMMAND tests/eosiod_run_remote_test.py --dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_test
(
NAME eosiod_run_remote_test COMMAND tests/eosiod_run_remote_test.py --dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_test
(
NAME p2p_dawn515_test COMMAND tests/p2p_tests/dawn_515/test.sh WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_test
(
NAME p2p_dawn515_test COMMAND tests/p2p_tests/dawn_515/test.sh WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
if
(
BUILD_MONGO_DB_PLUGIN
)
add_test
(
NAME eosiod_run_test-mongodb COMMAND tests/eosiod_run_test.py --mongodb --dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endif
()
# TODO: Tests removed until working again on master.
# TODO: Tests removed until working again on master.
# TODO: add_test(NAME p2p_sync_test COMMAND tests/p2p_tests/sync/test.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME p2p_sync_test COMMAND tests/p2p_tests/sync/test.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME p2p_sync_test_p2_d10 COMMAND tests/p2p_tests/sync/test.sh -p 2 -d 10 WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME p2p_sync_test_p2_d10 COMMAND tests/p2p_tests/sync/test.sh -p 2 -d 10 WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME message_storm COMMAND tests/p2p_tests/sync/test.sh -m -p 21 -n 21 -d 5 -l WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME message_storm COMMAND tests/p2p_tests/sync/test.sh -m -p 21 -n 21 -d 5 -l WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: if(BUILD_MONGO_DB_PLUGIN)
# TODO: add_test(NAME eosiod_run_test-mongodb COMMAND tests/eosiod_run_test.py --mongodb --dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: endif()
# TODO: add_test(NAME trans_sync_across_mixed_cluster_test COMMAND tests/trans_sync_across_mixed_cluster_test.sh -p 1 -n 2 WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME trans_sync_across_mixed_cluster_test COMMAND tests/trans_sync_across_mixed_cluster_test.sh -p 1 -n 2 WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME distributed-transactions-test COMMAND tests/distributed-transactions-test.py -p 1 -n 4 --dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME distributed-transactions-test COMMAND tests/distributed-transactions-test.py -p 1 -n 4 --dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME distributed-transactions-remote-test COMMAND tests/distributed-transactions-remote-test.py --dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# TODO: add_test(NAME distributed-transactions-remote-test COMMAND tests/distributed-transactions-remote-test.py --dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
...
...
tests/eosiod_run_test.py
浏览文件 @
93026fb1
...
@@ -14,10 +14,8 @@ import re
...
@@ -14,10 +14,8 @@ import re
###############################################################
###############################################################
Print
=
testUtils
.
Utils
.
Print
Print
=
testUtils
.
Utils
.
Print
errorExit
=
testUtils
.
Utils
.
errorExit
def
errorExit
(
msg
=
""
,
raw
=
False
,
errorCode
=
1
):
Print
(
"ERROR:"
if
not
raw
else
""
,
msg
)
exit
(
errorCode
)
def
cmdError
(
name
,
code
=
0
,
exitNow
=
False
):
def
cmdError
(
name
,
code
=
0
,
exitNow
=
False
):
msg
=
"FAILURE - %s%s"
%
(
name
,
(
""
if
code
==
0
else
(
" returned error code %d"
%
code
)))
msg
=
"FAILURE - %s%s"
%
(
name
,
(
""
if
code
==
0
else
(
" returned error code %d"
%
code
)))
...
@@ -374,7 +372,8 @@ try:
...
@@ -374,7 +372,8 @@ try:
amountVal
=
int
(
decimal
.
Decimal
(
amountVal
.
split
()[
0
])
*
10000
)
amountVal
=
int
(
decimal
.
Decimal
(
amountVal
.
split
()[
0
])
*
10000
)
else
:
else
:
typeVal
=
transaction
[
"name"
]
typeVal
=
transaction
[
"name"
]
amountVal
=
transaction
[
"data"
][
"amount"
]
amountVal
=
transaction
[
"data"
][
"quantity"
]
amountVal
=
int
(
decimal
.
Decimal
(
amountVal
.
split
()[
0
])
*
10000
)
else
:
else
:
if
not
enableMongo
:
if
not
enableMongo
:
typeVal
=
transaction
[
"transaction"
][
"messages"
][
0
][
"type"
]
typeVal
=
transaction
[
"transaction"
][
"messages"
][
0
][
"type"
]
...
@@ -582,7 +581,7 @@ try:
...
@@ -582,7 +581,7 @@ try:
for
blockNum
in
range
(
1
,
currentBlockNum
+
1
):
for
blockNum
in
range
(
1
,
currentBlockNum
+
1
):
block
=
node
.
getBlock
(
blockNum
,
retry
=
False
)
block
=
node
.
getBlock
(
blockNum
,
retry
=
False
)
if
block
is
None
:
if
block
is
None
:
cmdError
(
"% get block"
%
(
ClientName
))
cmdError
(
"%
s
get block"
%
(
ClientName
))
errorExit
(
"mongo get block by num %d"
%
blockNum
)
errorExit
(
"mongo get block by num %d"
%
blockNum
)
if
enableMongo
:
if
enableMongo
:
...
...
tests/testUtils.py
浏览文件 @
93026fb1
...
@@ -81,6 +81,11 @@ class Utils:
...
@@ -81,6 +81,11 @@ class Utils:
return
chainSyncStrategies
return
chainSyncStrategies
@
staticmethod
def
errorExit
(
msg
=
""
,
raw
=
False
,
errorCode
=
1
):
Utils
.
Print
(
"ERROR:"
if
not
raw
else
""
,
msg
)
exit
(
errorCode
)
###########################################################################################
###########################################################################################
class
Table
(
object
):
class
Table
(
object
):
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
...
@@ -405,7 +410,7 @@ class Node(object):
...
@@ -405,7 +410,7 @@ class Node(object):
Utils
.
Print
(
"Publish eosio.system contract"
)
Utils
.
Print
(
"Publish eosio.system contract"
)
trans
=
self
.
publishContract
(
eosio
.
name
,
wastFile
,
abiFile
,
waitForTransBlock
=
True
)
trans
=
self
.
publishContract
(
eosio
.
name
,
wastFile
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
if
trans
is
None
:
errorExit
(
"Failed to publish oesio.system."
)
Utils
.
errorExit
(
"Failed to publish oesio.system."
)
Utils
.
Print
(
"push issue action to eosio contract"
)
Utils
.
Print
(
"push issue action to eosio contract"
)
contract
=
eosio
.
name
contract
=
eosio
.
name
...
@@ -511,7 +516,7 @@ class Node(object):
...
@@ -511,7 +516,7 @@ class Node(object):
for
i
in
range
(
2
):
for
i
in
range
(
2
):
ret
=
self
.
getEosAccountFromDb
(
account
.
name
)
ret
=
self
.
getEosAccountFromDb
(
account
.
name
)
if
ret
is
not
None
:
if
ret
is
not
None
:
account_name
=
ret
[
"
account_
name"
]
account_name
=
ret
[
"name"
]
if
account_name
is
None
:
if
account_name
is
None
:
Utils
.
Print
(
"ERROR: Failed to verify account creation."
,
account
.
name
)
Utils
.
Print
(
"ERROR: Failed to verify account creation."
,
account
.
name
)
return
None
return
None
...
@@ -1112,7 +1117,7 @@ class Cluster(object):
...
@@ -1112,7 +1117,7 @@ class Cluster(object):
cmdArr
.
append
(
"--plugin eosio::wallet_api_plugin"
)
cmdArr
.
append
(
"--plugin eosio::wallet_api_plugin"
)
if
self
.
enableMongo
:
if
self
.
enableMongo
:
if
Utils
.
amINoon
:
if
Utils
.
amINoon
:
cmdArr
.
append
(
"--plugin eosio::mongo_db_plugin --mongodb-uri %s"
%
self
.
mongoUri
)
cmdArr
.
append
(
"--plugin eosio::mongo_db_plugin --
resync --
mongodb-uri %s"
%
self
.
mongoUri
)
else
:
else
:
cmdArr
.
append
(
"--plugin eosio::db_plugin --mongodb-uri %s"
%
self
.
mongoUri
)
cmdArr
.
append
(
"--plugin eosio::db_plugin --mongodb-uri %s"
%
self
.
mongoUri
)
...
@@ -1294,7 +1299,7 @@ class Cluster(object):
...
@@ -1294,7 +1299,7 @@ class Cluster(object):
for
account
in
accounts
:
for
account
in
accounts
:
Utils
.
Print
(
"Importing keys for account %s into wallet %s."
%
(
account
.
name
,
wallet
.
name
))
Utils
.
Print
(
"Importing keys for account %s into wallet %s."
%
(
account
.
name
,
wallet
.
name
))
if
not
self
.
walletMgr
.
importKey
(
account
,
wallet
):
if
not
self
.
walletMgr
.
importKey
(
account
,
wallet
):
errorExit
(
"Failed to import key for account %s"
%
(
account
.
name
))
Utils
.
errorExit
(
"Failed to import key for account %s"
%
(
account
.
name
))
return
False
return
False
self
.
accounts
=
accounts
self
.
accounts
=
accounts
...
...
tests/tests/abi_tests.cpp
浏览文件 @
93026fb1
...
@@ -1536,7 +1536,7 @@ BOOST_AUTO_TEST_CASE(abi_cycle)
...
@@ -1536,7 +1536,7 @@ BOOST_AUTO_TEST_CASE(abi_cycle)
BOOST_AUTO_TEST_CASE
(
linkauth
)
BOOST_AUTO_TEST_CASE
(
linkauth
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
BOOST_CHECK
(
true
);
BOOST_CHECK
(
true
);
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
...
@@ -1568,7 +1568,7 @@ BOOST_AUTO_TEST_CASE(linkauth)
...
@@ -1568,7 +1568,7 @@ BOOST_AUTO_TEST_CASE(linkauth)
BOOST_AUTO_TEST_CASE
(
unlinkauth
)
BOOST_AUTO_TEST_CASE
(
unlinkauth
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
BOOST_CHECK
(
true
);
BOOST_CHECK
(
true
);
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
...
@@ -1597,7 +1597,7 @@ BOOST_AUTO_TEST_CASE(unlinkauth)
...
@@ -1597,7 +1597,7 @@ BOOST_AUTO_TEST_CASE(unlinkauth)
BOOST_AUTO_TEST_CASE
(
updateauth
)
BOOST_AUTO_TEST_CASE
(
updateauth
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
BOOST_CHECK
(
true
);
BOOST_CHECK
(
true
);
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
...
@@ -1664,7 +1664,7 @@ BOOST_AUTO_TEST_CASE(updateauth)
...
@@ -1664,7 +1664,7 @@ BOOST_AUTO_TEST_CASE(updateauth)
BOOST_AUTO_TEST_CASE
(
deleteauth
)
BOOST_AUTO_TEST_CASE
(
deleteauth
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
BOOST_CHECK
(
true
);
BOOST_CHECK
(
true
);
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
...
@@ -1690,7 +1690,7 @@ BOOST_AUTO_TEST_CASE(deleteauth)
...
@@ -1690,7 +1690,7 @@ BOOST_AUTO_TEST_CASE(deleteauth)
BOOST_AUTO_TEST_CASE
(
newaccount
)
BOOST_AUTO_TEST_CASE
(
newaccount
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
BOOST_CHECK
(
true
);
BOOST_CHECK
(
true
);
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
...
@@ -1834,7 +1834,7 @@ BOOST_AUTO_TEST_CASE(newaccount)
...
@@ -1834,7 +1834,7 @@ BOOST_AUTO_TEST_CASE(newaccount)
BOOST_AUTO_TEST_CASE
(
setcode
)
BOOST_AUTO_TEST_CASE
(
setcode
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
{
{
...
@@ -1865,7 +1865,7 @@ BOOST_AUTO_TEST_CASE(setcode)
...
@@ -1865,7 +1865,7 @@ BOOST_AUTO_TEST_CASE(setcode)
BOOST_AUTO_TEST_CASE
(
setabi
)
BOOST_AUTO_TEST_CASE
(
setabi
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
{
{
...
@@ -2028,7 +2028,7 @@ BOOST_AUTO_TEST_CASE(setabi)
...
@@ -2028,7 +2028,7 @@ BOOST_AUTO_TEST_CASE(setabi)
BOOST_AUTO_TEST_CASE
(
postrecovery
)
BOOST_AUTO_TEST_CASE
(
postrecovery
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
{
{
...
@@ -2078,7 +2078,7 @@ BOOST_AUTO_TEST_CASE(postrecovery)
...
@@ -2078,7 +2078,7 @@ BOOST_AUTO_TEST_CASE(postrecovery)
BOOST_AUTO_TEST_CASE
(
passrecovery
)
BOOST_AUTO_TEST_CASE
(
passrecovery
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
{
{
...
@@ -2100,7 +2100,7 @@ BOOST_AUTO_TEST_CASE(passrecovery)
...
@@ -2100,7 +2100,7 @@ BOOST_AUTO_TEST_CASE(passrecovery)
BOOST_AUTO_TEST_CASE
(
vetorecovery
)
BOOST_AUTO_TEST_CASE
(
vetorecovery
)
{
try
{
{
try
{
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
());
abi_serializer
abis
(
chain_initializer
::
eos_contract_abi
(
abi_def
()
));
const
char
*
test_data
=
R"=====(
const
char
*
test_data
=
R"=====(
{
{
...
...
tests/wasm_tests/identity_tests.cpp
浏览文件 @
93026fb1
...
@@ -38,12 +38,12 @@ public:
...
@@ -38,12 +38,12 @@ public:
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
N
(
identity
)
);
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
N
(
identity
)
);
abi_def
abi
;
abi_def
abi
;
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
name
,
accnt
.
abi
,
abi
),
true
);
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
),
true
);
abi_ser
.
set_abi
(
abi
);
abi_ser
.
set_abi
(
abi
);
const
auto
&
acnt_test
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
N
(
identitytest
)
);
const
auto
&
acnt_test
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
N
(
identitytest
)
);
abi_def
abi_test
;
abi_def
abi_test
;
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
ac
cnt
.
name
,
ac
nt_test
.
abi
,
abi_test
),
true
);
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
acnt_test
.
abi
,
abi_test
),
true
);
abi_ser_test
.
set_abi
(
abi_test
);
abi_ser_test
.
set_abi
(
abi_test
);
const
global_property_object
&
gpo
=
control
->
get_global_properties
();
const
global_property_object
&
gpo
=
control
->
get_global_properties
();
...
...
tests/wasm_tests/wasm_tests.cpp
浏览文件 @
93026fb1
...
@@ -190,7 +190,7 @@ BOOST_FIXTURE_TEST_CASE( abi_from_variant, tester ) try {
...
@@ -190,7 +190,7 @@ BOOST_FIXTURE_TEST_CASE( abi_from_variant, tester ) try {
try
{
try
{
const
auto
&
accnt
=
this
->
control
->
get_database
().
get
<
account_object
,
by_name
>
(
name
);
const
auto
&
accnt
=
this
->
control
->
get_database
().
get
<
account_object
,
by_name
>
(
name
);
abi_def
abi
;
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
accnt
.
name
,
accnt
.
abi
,
abi
))
{
if
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
))
{
return
abi_serializer
(
abi
);
return
abi_serializer
(
abi
);
}
}
return
optional
<
abi_serializer
>
();
return
optional
<
abi_serializer
>
();
...
@@ -364,7 +364,7 @@ BOOST_FIXTURE_TEST_CASE( stl_test, tester ) try {
...
@@ -364,7 +364,7 @@ BOOST_FIXTURE_TEST_CASE( stl_test, tester ) try {
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
N
(
stltest
)
);
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
N
(
stltest
)
);
abi_def
abi
;
abi_def
abi
;
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
name
,
accnt
.
abi
,
abi
),
true
);
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
),
true
);
abi_serializer
abi_ser
(
abi
);
abi_serializer
abi_ser
(
abi
);
//send message
//send message
...
@@ -582,7 +582,7 @@ BOOST_FIXTURE_TEST_CASE(noop, tester) try {
...
@@ -582,7 +582,7 @@ BOOST_FIXTURE_TEST_CASE(noop, tester) try {
set_abi
(
N
(
noop
),
noop_abi
);
set_abi
(
N
(
noop
),
noop_abi
);
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
N
(
noop
));
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
N
(
noop
));
abi_def
abi
;
abi_def
abi
;
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
name
,
accnt
.
abi
,
abi
),
true
);
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
),
true
);
abi_serializer
abi_ser
(
abi
);
abi_serializer
abi_ser
(
abi
);
{
{
...
@@ -647,7 +647,7 @@ BOOST_FIXTURE_TEST_CASE(eosio_abi, tester) try {
...
@@ -647,7 +647,7 @@ BOOST_FIXTURE_TEST_CASE(eosio_abi, tester) try {
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
config
::
system_account_name
);
const
auto
&
accnt
=
control
->
get_database
().
get
<
account_object
,
by_name
>
(
config
::
system_account_name
);
abi_def
abi
;
abi_def
abi
;
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
name
,
accnt
.
abi
,
abi
),
true
);
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
),
true
);
abi_serializer
abi_ser
(
abi
);
abi_serializer
abi_ser
(
abi
);
abi_ser
.
validate
();
abi_ser
.
validate
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录