Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
eaad0eed
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,发现更多精彩内容 >>
未验证
提交
eaad0eed
编写于
9月 25, 2018
作者:
K
Kevin Heifner
提交者:
GitHub
9月 25, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5787 from EOSIO/abi-serializer-improve-error-messages
Verbose ABI serialization errors
上级
e55c7cb7
8218a70f
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
964 addition
and
255 deletion
+964
-255
libraries/chain/abi_serializer.cpp
libraries/chain/abi_serializer.cpp
+469
-101
libraries/chain/include/eosio/chain/abi_serializer.hpp
libraries/chain/include/eosio/chain/abi_serializer.hpp
+193
-124
libraries/fc
libraries/fc
+1
-1
plugins/chain_api_plugin/chain_api_plugin.cpp
plugins/chain_api_plugin/chain_api_plugin.cpp
+4
-1
plugins/chain_plugin/chain_plugin.cpp
plugins/chain_plugin/chain_plugin.cpp
+10
-10
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
.../chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
+5
-2
plugins/http_plugin/http_plugin.cpp
plugins/http_plugin/http_plugin.cpp
+4
-0
plugins/http_plugin/include/eosio/http_plugin/http_plugin.hpp
...ins/http_plugin/include/eosio/http_plugin/http_plugin.hpp
+5
-3
unittests/abi_tests.cpp
unittests/abi_tests.cpp
+273
-13
未找到文件。
libraries/chain/abi_serializer.cpp
浏览文件 @
eaad0eed
此差异已折叠。
点击以展开。
libraries/chain/include/eosio/chain/abi_serializer.hpp
浏览文件 @
eaad0eed
此差异已折叠。
点击以展开。
fc
@
aac546b4
比较
4dc8375d
...
aac546b4
Subproject commit
4dc8375d7d3e02ab1177ab5c22835f75b45c845a
Subproject commit
aac546b419891ef6644e0d99dba5e8d33f70401d
plugins/chain_api_plugin/chain_api_plugin.cpp
浏览文件 @
eaad0eed
...
...
@@ -79,7 +79,10 @@ void chain_api_plugin::plugin_startup() {
auto
ro_api
=
app
().
get_plugin
<
chain_plugin
>
().
get_read_only_api
();
auto
rw_api
=
app
().
get_plugin
<
chain_plugin
>
().
get_read_write_api
();
app
().
get_plugin
<
http_plugin
>
().
add_api
({
auto
&
_http_plugin
=
app
().
get_plugin
<
http_plugin
>
();
ro_api
.
set_shorten_abi_errors
(
!
_http_plugin
.
verbose_errors
()
);
_http_plugin
.
add_api
({
CHAIN_RO_CALL
(
get_info
,
200l
),
CHAIN_RO_CALL
(
get_block
,
200
),
CHAIN_RO_CALL
(
get_block_header_state
,
200
),
...
...
plugins/chain_plugin/chain_plugin.cpp
浏览文件 @
eaad0eed
...
...
@@ -1217,7 +1217,7 @@ static float64_t to_softfloat64( double d ) {
return
*
reinterpret_cast
<
float64_t
*>
(
&
d
);
}
static
fc
::
variant
get_global_row
(
const
database
&
db
,
const
abi_def
&
abi
,
const
abi_serializer
&
abis
,
const
fc
::
microseconds
&
abi_serializer_max_time_m
s
)
{
fc
::
variant
get_global_row
(
const
database
&
db
,
const
abi_def
&
abi
,
const
abi_serializer
&
abis
,
const
fc
::
microseconds
&
abi_serializer_max_time_ms
,
bool
shorten_abi_error
s
)
{
const
auto
table_type
=
get_table_type
(
abi
,
N
(
global
));
EOS_ASSERT
(
table_type
==
read_only
::
KEYi64
,
chain
::
contract_table_query_exception
,
"Invalid table type ${type} for table global"
,
(
"type"
,
table_type
));
...
...
@@ -1230,7 +1230,7 @@ static fc::variant get_global_row( const database& db, const abi_def& abi, const
vector
<
char
>
data
;
read_only
::
copy_inline_row
(
*
it
,
data
);
return
abis
.
binary_to_variant
(
abis
.
get_table_type
(
N
(
global
)),
data
,
abi_serializer_max_time_ms
);
return
abis
.
binary_to_variant
(
abis
.
get_table_type
(
N
(
global
)),
data
,
abi_serializer_max_time_ms
,
shorten_abi_errors
);
}
read_only
::
get_producers_result
read_only
::
get_producers
(
const
read_only
::
get_producers_params
&
p
)
const
{
...
...
@@ -1275,12 +1275,12 @@ read_only::get_producers_result read_only::get_producers( const read_only::get_p
}
copy_inline_row
(
*
kv_index
.
find
(
boost
::
make_tuple
(
table_id
->
id
,
it
->
primary_key
)),
data
);
if
(
p
.
json
)
result
.
rows
.
emplace_back
(
abis
.
binary_to_variant
(
abis
.
get_table_type
(
N
(
producers
)),
data
,
abi_serializer_max_time
)
);
result
.
rows
.
emplace_back
(
abis
.
binary_to_variant
(
abis
.
get_table_type
(
N
(
producers
)),
data
,
abi_serializer_max_time
,
shorten_abi_errors
)
);
else
result
.
rows
.
emplace_back
(
fc
::
variant
(
data
));
}
result
.
total_producer_vote_weight
=
get_global_row
(
d
,
abi
,
abis
,
abi_serializer_max_time
)[
"total_producer_vote_weight"
].
as_double
();
result
.
total_producer_vote_weight
=
get_global_row
(
d
,
abi
,
abis
,
abi_serializer_max_time
,
shorten_abi_errors
)[
"total_producer_vote_weight"
].
as_double
();
return
result
;
}
...
...
@@ -1668,7 +1668,7 @@ read_only::get_account_results read_only::get_account( const get_account_params&
if
(
it
!=
idx
.
end
()
)
{
vector
<
char
>
data
;
copy_inline_row
(
*
it
,
data
);
result
.
total_resources
=
abis
.
binary_to_variant
(
"user_resources"
,
data
,
abi_serializer_max_time
);
result
.
total_resources
=
abis
.
binary_to_variant
(
"user_resources"
,
data
,
abi_serializer_max_time
,
shorten_abi_errors
);
}
}
...
...
@@ -1679,7 +1679,7 @@ read_only::get_account_results read_only::get_account( const get_account_params&
if
(
it
!=
idx
.
end
()
)
{
vector
<
char
>
data
;
copy_inline_row
(
*
it
,
data
);
result
.
self_delegated_bandwidth
=
abis
.
binary_to_variant
(
"delegated_bandwidth"
,
data
,
abi_serializer_max_time
);
result
.
self_delegated_bandwidth
=
abis
.
binary_to_variant
(
"delegated_bandwidth"
,
data
,
abi_serializer_max_time
,
shorten_abi_errors
);
}
}
...
...
@@ -1690,7 +1690,7 @@ read_only::get_account_results read_only::get_account( const get_account_params&
if
(
it
!=
idx
.
end
()
)
{
vector
<
char
>
data
;
copy_inline_row
(
*
it
,
data
);
result
.
refund_request
=
abis
.
binary_to_variant
(
"refund_request"
,
data
,
abi_serializer_max_time
);
result
.
refund_request
=
abis
.
binary_to_variant
(
"refund_request"
,
data
,
abi_serializer_max_time
,
shorten_abi_errors
);
}
}
...
...
@@ -1701,7 +1701,7 @@ read_only::get_account_results read_only::get_account( const get_account_params&
if
(
it
!=
idx
.
end
()
)
{
vector
<
char
>
data
;
copy_inline_row
(
*
it
,
data
);
result
.
voter_info
=
abis
.
binary_to_variant
(
"voter_info"
,
data
,
abi_serializer_max_time
);
result
.
voter_info
=
abis
.
binary_to_variant
(
"voter_info"
,
data
,
abi_serializer_max_time
,
shorten_abi_errors
);
}
}
}
...
...
@@ -1727,7 +1727,7 @@ read_only::abi_json_to_bin_result read_only::abi_json_to_bin( const read_only::a
auto
action_type
=
abis
.
get_action_type
(
params
.
action
);
EOS_ASSERT
(
!
action_type
.
empty
(),
action_validate_exception
,
"Unknown action ${action} in contract ${contract}"
,
(
"action"
,
params
.
action
)(
"contract"
,
params
.
code
));
try
{
result
.
binargs
=
abis
.
variant_to_binary
(
action_type
,
params
.
args
,
abi_serializer_max_time
);
result
.
binargs
=
abis
.
variant_to_binary
(
action_type
,
params
.
args
,
abi_serializer_max_time
,
shorten_abi_errors
);
}
EOS_RETHROW_EXCEPTIONS
(
chain
::
invalid_action_args_exception
,
"'${args}' is invalid args for action '${action}' code '${code}'. expected '${proto}'"
,
(
"args"
,
params
.
args
)(
"action"
,
params
.
action
)(
"code"
,
params
.
code
)(
"proto"
,
action_abi_to_variant
(
abi
,
action_type
)))
...
...
@@ -1744,7 +1744,7 @@ read_only::abi_bin_to_json_result read_only::abi_bin_to_json( const read_only::a
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
code_account
.
abi
,
abi
)
)
{
abi_serializer
abis
(
abi
,
abi_serializer_max_time
);
result
.
args
=
abis
.
binary_to_variant
(
abis
.
get_action_type
(
params
.
action
),
params
.
binargs
,
abi_serializer_max_time
);
result
.
args
=
abis
.
binary_to_variant
(
abis
.
get_action_type
(
params
.
action
),
params
.
binargs
,
abi_serializer_max_time
,
shorten_abi_errors
);
}
else
{
EOS_ASSERT
(
false
,
abi_not_found_exception
,
"No ABI found for ${contract}"
,
(
"contract"
,
params
.
code
));
}
...
...
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
浏览文件 @
eaad0eed
...
...
@@ -68,6 +68,7 @@ uint64_t convert_to_type(const string& str, const string& desc);
class
read_only
{
const
controller
&
db
;
const
fc
::
microseconds
abi_serializer_max_time
;
bool
shorten_abi_errors
=
true
;
public:
static
const
string
KEYi64
;
...
...
@@ -77,6 +78,8 @@ public:
void
validate
()
const
{}
void
set_shorten_abi_errors
(
bool
f
)
{
shorten_abi_errors
=
f
;
}
using
get_info_params
=
empty
;
struct
get_info_results
{
...
...
@@ -434,7 +437,7 @@ public:
copy_inline_row
(
*
itr2
,
data
);
if
(
p
.
json
)
{
result
.
rows
.
emplace_back
(
abis
.
binary_to_variant
(
abis
.
get_table_type
(
p
.
table
),
data
,
abi_serializer_max_time
)
);
result
.
rows
.
emplace_back
(
abis
.
binary_to_variant
(
abis
.
get_table_type
(
p
.
table
),
data
,
abi_serializer_max_time
,
shorten_abi_errors
)
);
}
else
{
result
.
rows
.
emplace_back
(
fc
::
variant
(
data
));
}
...
...
@@ -495,7 +498,7 @@ public:
copy_inline_row
(
*
itr
,
data
);
if
(
p
.
json
)
{
result
.
rows
.
emplace_back
(
abis
.
binary_to_variant
(
abis
.
get_table_type
(
p
.
table
),
data
,
abi_serializer_max_time
)
);
result
.
rows
.
emplace_back
(
abis
.
binary_to_variant
(
abis
.
get_table_type
(
p
.
table
),
data
,
abi_serializer_max_time
,
shorten_abi_errors
)
);
}
else
{
result
.
rows
.
emplace_back
(
fc
::
variant
(
data
));
}
...
...
plugins/http_plugin/http_plugin.cpp
浏览文件 @
eaad0eed
...
...
@@ -606,4 +606,8 @@ namespace eosio {
return
(
!
my
->
listen_endpoint
||
my
->
listen_endpoint
->
address
().
is_loopback
());
}
bool
http_plugin
::
verbose_errors
()
const
{
return
verbose_http_errors
;
}
}
plugins/http_plugin/include/eosio/http_plugin/http_plugin.hpp
浏览文件 @
eaad0eed
...
...
@@ -60,12 +60,12 @@ namespace eosio {
* called with the response code and body.
*
* The handler will be called from the appbase application io_service
* thread. The callback can be called from any thread and will
* thread. The callback can be called from any thread and will
* automatically propagate the call to the http thread.
*
* The HTTP service will run in its own thread with its own io_service to
* make sure that HTTP request processing does not interfer with other
* plugins.
* plugins.
*/
class
http_plugin
:
public
appbase
::
plugin
<
http_plugin
>
{
...
...
@@ -85,7 +85,7 @@ namespace eosio {
void
add_handler
(
const
string
&
url
,
const
url_handler
&
);
void
add_api
(
const
api_description
&
api
)
{
for
(
const
auto
&
call
:
api
)
for
(
const
auto
&
call
:
api
)
add_handler
(
call
.
first
,
call
.
second
);
}
...
...
@@ -95,6 +95,8 @@ namespace eosio {
bool
is_on_loopback
()
const
;
bool
is_secure
()
const
;
bool
verbose_errors
()
const
;
private:
std
::
unique_ptr
<
class
http_plugin_impl
>
my
;
};
...
...
unittests/abi_tests.cpp
浏览文件 @
eaad0eed
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录