Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
150184b0
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,发现更多精彩内容 >>
未验证
提交
150184b0
编写于
11月 13, 2017
作者:
K
Kevin Heifner
提交者:
GitHub
11月 13, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #681 from EOSIO/gcc-issue-665
Fixes for GCC compiler errors
上级
74034e8d
cfccb9e2
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
109 addition
and
105 deletion
+109
-105
libraries/chain/chain_controller.cpp
libraries/chain/chain_controller.cpp
+11
-11
libraries/chain/include/eos/chain/transaction.hpp
libraries/chain/include/eos/chain/transaction.hpp
+3
-3
libraries/native_contract/eos_contract.cpp
libraries/native_contract/eos_contract.cpp
+7
-7
libraries/types/abi_serializer.cpp
libraries/types/abi_serializer.cpp
+2
-2
libraries/types/include/eos/types/abi_serializer.hpp
libraries/types/include/eos/types/abi_serializer.hpp
+1
-1
libraries/types/types.eos
libraries/types/types.eos
+4
-4
plugins/account_history_plugin/account_history_plugin.cpp
plugins/account_history_plugin/account_history_plugin.cpp
+6
-6
plugins/account_history_plugin/include/eos/account_history_plugin/account_history_plugin.hpp
...ude/eos/account_history_plugin/account_history_plugin.hpp
+4
-4
plugins/account_history_plugin/include/eos/account_history_plugin/account_transaction_history_object.hpp
...unt_history_plugin/account_transaction_history_object.hpp
+4
-4
plugins/account_history_plugin/include/eos/account_history_plugin/public_key_history_object.hpp
.../eos/account_history_plugin/public_key_history_object.hpp
+4
-4
plugins/chain_plugin/chain_plugin.cpp
plugins/chain_plugin/chain_plugin.cpp
+8
-8
plugins/chain_plugin/include/eos/chain_plugin/chain_plugin.hpp
...ns/chain_plugin/include/eos/chain_plugin/chain_plugin.hpp
+11
-11
plugins/db_plugin/db_plugin.cpp
plugins/db_plugin/db_plugin.cpp
+7
-3
programs/eosc/main.cpp
programs/eosc/main.cpp
+4
-4
tests/api_tests/api_tests.cpp
tests/api_tests/api_tests.cpp
+1
-1
tests/tests/abi_tests.cpp
tests/tests/abi_tests.cpp
+32
-32
未找到文件。
libraries/chain/chain_controller.cpp
浏览文件 @
150184b0
...
...
@@ -629,8 +629,8 @@ void check_output(const generated_transaction& expected, const generated_transac
template
<
>
void
check_output
(
const
message_output
&
expected
,
const
message_output
&
actual
,
const
path_cons_list
&
path
)
{
check_output
(
expected
.
notify
,
actual
.
notify
,
path
(
".notify"
));
check_output
(
expected
.
inline_tr
ansaction
,
actual
.
inline_transaction
,
path
(
".inline_transaction
"
));
check_output
(
expected
.
deferred_tr
ansactions
,
actual
.
deferred_transactions
,
path
(
".deferred_transaction
s"
));
check_output
(
expected
.
inline_tr
x
,
actual
.
inline_trx
,
path
(
".inline_trx
"
));
check_output
(
expected
.
deferred_tr
xs
,
actual
.
deferred_trxs
,
path
(
".deferred_trx
s"
));
}
template
<
typename
T
>
...
...
@@ -973,8 +973,8 @@ void chain_controller::process_message(const transaction& trx, account_name code
// combine inline messages and process
if
(
apply_ctx
.
inline_messages
.
size
()
>
0
)
{
output
.
inline_tr
ansaction
=
inline_transaction
(
trx
);
(
*
output
.
inline_tr
ansaction
).
messages
=
std
::
move
(
apply_ctx
.
inline_messages
);
output
.
inline_tr
x
=
inline_transaction
(
trx
);
(
*
output
.
inline_tr
x
).
messages
=
std
::
move
(
apply_ctx
.
inline_messages
);
}
for
(
auto
&
asynctrx
:
apply_ctx
.
deferred_transactions
)
{
...
...
@@ -989,7 +989,7 @@ void chain_controller::process_message(const transaction& trx, account_name code
transaction
.
status
=
generated_transaction_object
::
PENDING
;
});
output
.
deferred_tr
ansaction
s
.
emplace_back
(
gtrx
);
output
.
deferred_tr
x
s
.
emplace_back
(
gtrx
);
}
// propagate used_authorizations up the context chain
...
...
@@ -1062,9 +1062,9 @@ typename T::processed chain_controller::process_transaction( const T& trx, int d
auto
&
output
=
ptrx
.
output
[
i
];
rate_limit_message
(
trx
.
messages
[
i
]);
process_message
(
trx
,
trx
.
messages
[
i
].
code
,
trx
.
messages
[
i
],
output
);
if
(
output
.
inline_tr
ansaction
.
valid
()
)
{
const
transaction
&
trx
=
*
output
.
inline_tr
ansaction
;
output
.
inline_tr
ansaction
=
process_transaction
(
pending_inline_transaction
(
trx
),
depth
+
1
,
start_time
);
if
(
output
.
inline_tr
x
.
valid
()
)
{
const
transaction
&
trx
=
*
output
.
inline_tr
x
;
output
.
inline_tr
x
=
process_transaction
(
pending_inline_transaction
(
trx
),
depth
+
1
,
start_time
);
}
}
...
...
@@ -1564,9 +1564,9 @@ processed_transaction chain_controller::transaction_from_variant( const fc::vari
result
.
messages
[
i
].
data
=
message_to_binary
(
result
.
messages
[
i
].
code
,
result
.
messages
[
i
].
type
,
data
);
/*
const auto& code_account = _db.get<account_object,by_name>( result.messages[i].code );
eosio::types::abi abi;
if( abi_serializer::to_abi(code_account.
abi,
abi) ) {
types::abi_serializer abis( abi );
eosio::types::abi
code_
abi;
if( abi_serializer::to_abi(code_account.
code_abi, code_
abi) ) {
types::abi_serializer abis(
code_
abi );
result.messages[i].data = abis.variant_to_binary( abis.get_action_type( result.messages[i].type ), data );
}
*/
...
...
libraries/chain/include/eos/chain/transaction.hpp
浏览文件 @
150184b0
...
...
@@ -170,8 +170,8 @@ namespace eosio { namespace chain {
*/
struct
message_output
{
vector
<
notify_output
>
notify
;
///< accounts to notify, may only be notified once
fc
::
optional
<
inline_transaction
>
inline_tr
ansaction
;
///< transactions generated and applied after notify
vector
<
generated_transaction
>
deferred_tr
ansaction
s
;
///< transactions generated but not applied
fc
::
optional
<
inline_transaction
>
inline_tr
x
;
///< transactions generated and applied after notify
vector
<
generated_transaction
>
deferred_tr
x
s
;
///< transactions generated but not applied
};
struct
notify_output
{
...
...
@@ -200,7 +200,7 @@ namespace eosio { namespace chain {
FC_REFLECT
(
eosio
::
chain
::
generated_transaction
,
(
id
))
FC_REFLECT_DERIVED
(
eosio
::
chain
::
signed_transaction
,
(
eosio
::
types
::
signed_transaction
),
)
FC_REFLECT
(
eosio
::
chain
::
message_output
,
(
notify
)(
inline_tr
ansaction
)(
deferred_transaction
s
)
)
FC_REFLECT
(
eosio
::
chain
::
message_output
,
(
notify
)(
inline_tr
x
)(
deferred_trx
s
)
)
FC_REFLECT_DERIVED
(
eosio
::
chain
::
processed_transaction
,
(
eosio
::
types
::
signed_transaction
),
(
output
)
)
FC_REFLECT_DERIVED
(
eosio
::
chain
::
pending_inline_transaction
,
(
eosio
::
types
::
transaction
),
)
FC_REFLECT_DERIVED
(
eosio
::
chain
::
inline_transaction
,
(
eosio
::
types
::
transaction
),
(
output
)
)
...
...
libraries/native_contract/eos_contract.cpp
浏览文件 @
150184b0
...
...
@@ -197,7 +197,7 @@ void apply_eos_setcode(apply_context& context) {
/// if an ABI is specified make sure it is well formed and doesn't
/// reference any undefined types
abi_serializer
(
msg
.
abi
).
validate
();
abi_serializer
(
msg
.
code_
abi
).
validate
();
const
auto
&
account
=
db
.
get
<
account_object
,
by_name
>
(
msg
.
account
);
...
...
@@ -209,7 +209,7 @@ void apply_eos_setcode(apply_context& context) {
a
.
code
.
resize
(
msg
.
code
.
size
()
);
memcpy
(
a
.
code
.
data
(),
msg
.
code
.
data
(),
msg
.
code
.
size
()
);
a
.
set_abi
(
msg
.
abi
);
a
.
set_abi
(
msg
.
code_
abi
);
});
apply_context
init_context
(
context
.
mutable_controller
,
context
.
mutable_db
,
context
.
trx
,
context
.
msg
,
msg
.
account
);
...
...
@@ -370,8 +370,8 @@ void apply_eos_updateauth(apply_context& context) {
EOS_ASSERT
(
!
update
.
permission
.
empty
(),
message_validate_exception
,
"Cannot create authority with empty name"
);
EOS_ASSERT
(
update
.
permission
!=
update
.
parent
,
message_validate_exception
,
"Cannot set an authority as its own parent"
);
EOS_ASSERT
(
validate
(
update
.
authority
),
message_validate_exception
,
"Invalid authority: ${auth}"
,
(
"auth"
,
update
.
authority
));
EOS_ASSERT
(
validate
(
update
.
new_
authority
),
message_validate_exception
,
"Invalid authority: ${auth}"
,
(
"auth"
,
update
.
new_
authority
));
if
(
update
.
permission
==
"active"
)
EOS_ASSERT
(
update
.
parent
==
"owner"
,
message_validate_exception
,
"Cannot change active authority's parent"
);
if
(
update
.
permission
==
"owner"
)
...
...
@@ -381,7 +381,7 @@ void apply_eos_updateauth(apply_context& context) {
context
.
require_authorization
(
update
.
account
);
db
.
get
<
account_object
,
by_name
>
(
update
.
account
);
validate_authority_precondition
(
context
,
update
.
authority
);
validate_authority_precondition
(
context
,
update
.
new_
authority
);
auto
permission
=
db
.
find
<
permission_object
,
by_owner
>
(
boost
::
make_tuple
(
update
.
account
,
update
.
permission
));
...
...
@@ -398,7 +398,7 @@ void apply_eos_updateauth(apply_context& context) {
// TODO/QUESTION: If we are updating an existing permission, should we check if the message declared
// permission satisfies the permission we want to modify?
db
.
modify
(
*
permission
,
[
&
update
,
&
parent_id
](
permission_object
&
po
)
{
po
.
auth
=
update
.
authority
;
po
.
auth
=
update
.
new_
authority
;
po
.
parent
=
parent_id
;
});
}
else
if
(
context
.
controller
.
is_applying_block
())
{
...
...
@@ -407,7 +407,7 @@ void apply_eos_updateauth(apply_context& context) {
db
.
create
<
permission_object
>
([
&
update
,
&
parent_id
](
permission_object
&
po
)
{
po
.
name
=
update
.
permission
;
po
.
owner
=
update
.
account
;
po
.
auth
=
update
.
authority
;
po
.
auth
=
update
.
new_
authority
;
po
.
parent
=
parent_id
;
});
}
...
...
libraries/types/abi_serializer.cpp
浏览文件 @
150184b0
...
...
@@ -39,7 +39,7 @@ namespace eosio { namespace types {
abi_serializer
::
abi_serializer
(
const
abi
&
abi
)
{
configure_built_in_types
();
set
A
bi
(
abi
);
set
_a
bi
(
abi
);
}
void
abi_serializer
::
configure_built_in_types
()
{
...
...
@@ -98,7 +98,7 @@ namespace eosio { namespace types {
built_in_types
.
emplace
(
"abi"
,
packUnpack
<
abi
>
());
}
void
abi_serializer
::
set
Abi
(
const
abi
&
abi
)
{
void
abi_serializer
::
set
_abi
(
const
abi
&
abi
)
{
typedefs
.
clear
();
structs
.
clear
();
actions
.
clear
();
...
...
libraries/types/include/eos/types/abi_serializer.hpp
浏览文件 @
150184b0
...
...
@@ -19,7 +19,7 @@ using std::pair;
struct
abi_serializer
{
abi_serializer
(){
configure_built_in_types
();
}
abi_serializer
(
const
abi
&
abi
);
void
set
Abi
(
const
abi
&
abi
);
void
set
_abi
(
const
abi
&
abi
);
map
<
type_name
,
type_name
>
typedefs
;
map
<
type_name
,
struct_t
>
structs
;
...
...
libraries/types/types.eos
浏览文件 @
150184b0
...
...
@@ -104,10 +104,10 @@ struct newaccount
struct setcode
account account_name # the account that is handling the message
vm_type
uint8 # the virtual machine type
vm_version
uint8 # the virtual machine version
vm_type uint8 # the virtual machine type
vm_version uint8 # the virtual machine version
code bytes # the apply
abi
abi # the interface description of the code
code_abi
abi # the interface description of the code
struct setproducer
...
...
@@ -130,7 +130,7 @@ struct updateauth
account account_name
permission permission_name
parent permission_name
authority authority
new_
authority authority
struct deleteauth
account account_name
...
...
plugins/account_history_plugin/account_history_plugin.cpp
浏览文件 @
150184b0
...
...
@@ -266,7 +266,7 @@ vector<account_name> account_history_plugin_impl::get_key_accounts(const public_
auto
range
=
pub_key_idx
.
equal_range
(
public_key
);
for
(
auto
obj
=
range
.
first
;
obj
!=
range
.
second
;
++
obj
)
{
accounts
.
insert
(
obj
->
account_
name
);
accounts
.
insert
(
obj
->
name
);
}
}
);
return
vector
<
account_name
>
(
accounts
.
begin
(),
accounts
.
end
());
...
...
@@ -309,7 +309,7 @@ void account_history_plugin_impl::applied_block(const signed_block& block)
for
(
const
auto
&
account_name
:
trx
.
scope
)
{
db
.
create
<
account_transaction_history_object
>
([
&
trx
,
&
account_name
](
account_transaction_history_object
&
account_transaction_history
)
{
account_transaction_history
.
account_
name
=
account_name
;
account_transaction_history
.
name
=
account_name
;
account_transaction_history
.
transaction_id
=
trx
.
id
();
});
}
...
...
@@ -333,10 +333,10 @@ void account_history_plugin_impl::applied_block(const signed_block& block)
{
const
auto
update
=
msg
.
as
<
types
::
updateauth
>
();
remove
<
public_key_history_multi_index
,
by_account_permission
>
(
db
,
update
.
account
,
update
.
permission
);
add
(
db
,
update
.
authority
.
keys
,
update
.
account
,
update
.
permission
);
add
(
db
,
update
.
new_
authority
.
keys
,
update
.
account
,
update
.
permission
);
remove
<
account_control_history_multi_index
,
by_controlled_authority
>
(
db
,
update
.
account
,
update
.
permission
);
add
(
db
,
update
.
authority
.
accounts
,
update
.
account
,
update
.
permission
);
add
(
db
,
update
.
new_
authority
.
accounts
,
update
.
account
,
update
.
permission
);
}
else
if
(
msg
.
type
==
DELETE_AUTH
)
{
...
...
@@ -352,13 +352,13 @@ void account_history_plugin_impl::applied_block(const signed_block& block)
}
}
void
account_history_plugin_impl
::
add
(
chainbase
::
database
&
db
,
const
vector
<
types
::
key_permission_weight
>&
keys
,
const
account_name
&
account_
name
,
const
permission_name
&
permission
)
void
account_history_plugin_impl
::
add
(
chainbase
::
database
&
db
,
const
vector
<
types
::
key_permission_weight
>&
keys
,
const
account_name
&
name
,
const
permission_name
&
permission
)
{
for
(
auto
pub_key_weight
:
keys
)
{
db
.
create
<
public_key_history_object
>
([
&
](
public_key_history_object
&
obj
)
{
obj
.
public_key
=
pub_key_weight
.
key
;
obj
.
account_name
=
account_
name
;
obj
.
name
=
name
;
obj
.
permission
=
permission
;
});
}
...
...
plugins/account_history_plugin/include/eos/account_history_plugin/account_history_plugin.hpp
浏览文件 @
150184b0
...
...
@@ -42,7 +42,7 @@ public:
struct
get_transactions_params
{
chain
::
account_name
account_name
;
name
account_name
;
optional
<
uint32_t
>
skip_seq
;
optional
<
uint32_t
>
num_seq
;
};
...
...
@@ -63,16 +63,16 @@ public:
chain
::
public_key_type
public_key
;
};
struct
get_key_accounts_results
{
vector
<
chain
::
account_
name
>
account_names
;
vector
<
name
>
account_names
;
};
get_key_accounts_results
get_key_accounts
(
const
get_key_accounts_params
&
params
)
const
;
struct
get_controlled_accounts_params
{
chain
::
account_
name
controlling_account
;
name
controlling_account
;
};
struct
get_controlled_accounts_results
{
vector
<
chain
::
account_
name
>
controlled_accounts
;
vector
<
name
>
controlled_accounts
;
};
get_controlled_accounts_results
get_controlled_accounts
(
const
get_controlled_accounts_params
&
params
)
const
;
};
...
...
plugins/account_history_plugin/include/eos/account_history_plugin/account_transaction_history_object.hpp
浏览文件 @
150184b0
...
...
@@ -29,7 +29,7 @@ class account_transaction_history_object : public chainbase::object<chain::accou
OBJECT_CTOR
(
account_transaction_history_object
)
id_type
id
;
account_name
account_
name
;
account_name
name
;
transaction_id_type
transaction_id
;
};
...
...
@@ -40,10 +40,10 @@ using account_transaction_history_multi_index = chainbase::shared_multi_index_co
account_transaction_history_object
,
indexed_by
<
ordered_unique
<
tag
<
by_id
>
,
BOOST_MULTI_INDEX_MEMBER
(
account_transaction_history_object
,
account_transaction_history_object
::
id_type
,
id
)
>
,
hashed_non_unique
<
tag
<
by_account_name
>
,
BOOST_MULTI_INDEX_MEMBER
(
account_transaction_history_object
,
account_name
,
account_
name
),
std
::
hash
<
account_name
>>
,
hashed_non_unique
<
tag
<
by_account_name
>
,
BOOST_MULTI_INDEX_MEMBER
(
account_transaction_history_object
,
account_name
,
name
),
std
::
hash
<
account_name
>>
,
hashed_unique
<
tag
<
by_account_name_trx_id
>
,
composite_key
<
account_transaction_history_object
,
member
<
account_transaction_history_object
,
account_name
,
&
account_transaction_history_object
::
account_
name
>
,
member
<
account_transaction_history_object
,
account_name
,
&
account_transaction_history_object
::
name
>
,
member
<
account_transaction_history_object
,
transaction_id_type
,
&
account_transaction_history_object
::
transaction_id
>
>
,
composite_key_hash
<
std
::
hash
<
account_name
>
,
std
::
hash
<
transaction_id_type
>
>
...
...
@@ -57,5 +57,5 @@ typedef chainbase::generic_index<account_transaction_history_multi_index> accoun
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
account_transaction_history_object
,
eosio
::
account_transaction_history_multi_index
)
FC_REFLECT
(
eosio
::
account_transaction_history_object
,
(
account_
name
)(
transaction_id
)
)
FC_REFLECT
(
eosio
::
account_transaction_history_object
,
(
name
)(
transaction_id
)
)
plugins/account_history_plugin/include/eos/account_history_plugin/public_key_history_object.hpp
浏览文件 @
150184b0
...
...
@@ -31,8 +31,8 @@ class public_key_history_object : public chainbase::object<chain::public_key_his
id_type
id
;
public_key_type
public_key
;
account_name
account_
name
;
permission_name
permission
;
account_name
name
;
permission_name
permission
;
};
struct
by_id
;
...
...
@@ -45,7 +45,7 @@ using public_key_history_multi_index = chainbase::shared_multi_index_container<
hashed_non_unique
<
tag
<
by_pub_key
>
,
BOOST_MULTI_INDEX_MEMBER
(
public_key_history_object
,
public_key_type
,
public_key
),
std
::
hash
<
public_key_type
>
>
,
hashed_non_unique
<
tag
<
by_account_permission
>
,
composite_key
<
public_key_history_object
,
member
<
public_key_history_object
,
account_name
,
&
public_key_history_object
::
account_
name
>
,
member
<
public_key_history_object
,
account_name
,
&
public_key_history_object
::
name
>
,
member
<
public_key_history_object
,
permission_name
,
&
public_key_history_object
::
permission
>
>
,
composite_key_hash
<
...
...
@@ -62,5 +62,5 @@ typedef chainbase::generic_index<public_key_history_multi_index> public_key_hist
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
public_key_history_object
,
eosio
::
public_key_history_multi_index
)
FC_REFLECT
(
eosio
::
public_key_history_object
,
(
public_key
)(
account_
name
)(
permission
)
)
FC_REFLECT
(
eosio
::
public_key_history_object
,
(
public_key
)(
name
)(
permission
)
)
plugins/chain_plugin/chain_plugin.cpp
浏览文件 @
150184b0
...
...
@@ -338,7 +338,7 @@ read_only::get_table_rows_result read_only::get_table_rows( const read_only::get
if
(
table_key
==
TERTIARY
)
return
get_table_rows_ex
<
chain
::
key64x64x64_value_index
,
chain
::
by_scope_tertiary
>
(
p
,
abi
);
}
FC_ASSERT
(
false
,
"invalid table type/key ${type}/${key}"
,
(
"type"
,
table_type
)(
"key"
,
table_key
)(
"abi"
,
abi
));
FC_ASSERT
(
false
,
"invalid table type/key ${type}/${key}"
,
(
"type"
,
table_type
)(
"key"
,
table_key
)(
"
code_
abi"
,
abi
));
}
read_only
::
get_block_results
read_only
::
get_block
(
const
read_only
::
get_block_params
&
params
)
const
{
...
...
@@ -385,9 +385,9 @@ read_write::push_transactions_results read_write::push_transactions(const read_w
read_only
::
get_code_results
read_only
::
get_code
(
const
get_code_params
&
params
)
const
{
get_code_results
result
;
result
.
name
=
params
.
name
;
result
.
account_name
=
params
.
account_
name
;
const
auto
&
d
=
db
.
get_database
();
const
auto
&
accnt
=
d
.
get
<
account_object
,
by_name
>
(
params
.
name
);
const
auto
&
accnt
=
d
.
get
<
account_object
,
by_name
>
(
params
.
account_
name
);
if
(
accnt
.
code
.
size
()
)
{
result
.
wast
=
chain
::
wasm_to_wast
(
(
const
uint8_t
*
)
accnt
.
code
.
data
(),
accnt
.
code
.
size
()
);
...
...
@@ -404,11 +404,11 @@ read_only::get_account_results read_only::get_account( const get_account_params&
using
namespace
native
::
eosio
;
get_account_results
result
;
result
.
name
=
params
.
name
;
result
.
account_name
=
params
.
account_
name
;
const
auto
&
d
=
db
.
get_database
();
const
auto
&
balance
=
d
.
get
<
balance_object
,
by_owner_name
>
(
params
.
name
);
const
auto
&
staked_balance
=
d
.
get
<
staked_balance_object
,
by_owner_name
>
(
params
.
name
);
const
auto
&
balance
=
d
.
get
<
balance_object
,
by_owner_name
>
(
params
.
account_
name
);
const
auto
&
staked_balance
=
d
.
get
<
staked_balance_object
,
by_owner_name
>
(
params
.
account_
name
);
result
.
eos_balance
=
asset
(
balance
.
balance
,
EOS_SYMBOL
);
result
.
staked_balance
=
asset
(
staked_balance
.
staked_balance
);
...
...
@@ -416,8 +416,8 @@ read_only::get_account_results read_only::get_account( const get_account_params&
result
.
last_unstaking_time
=
staked_balance
.
last_unstaking_time
;
const
auto
&
permissions
=
d
.
get_index
<
permission_index
,
by_owner
>
();
auto
perm
=
permissions
.
lower_bound
(
boost
::
make_tuple
(
params
.
name
)
);
while
(
perm
!=
permissions
.
end
()
&&
perm
->
owner
==
params
.
name
)
{
auto
perm
=
permissions
.
lower_bound
(
boost
::
make_tuple
(
params
.
account_
name
)
);
while
(
perm
!=
permissions
.
end
()
&&
perm
->
owner
==
params
.
account_
name
)
{
/// TODO: lookup perm->parent name
name
parent
;
...
...
plugins/chain_plugin/include/eos/chain_plugin/chain_plugin.hpp
浏览文件 @
150184b0
...
...
@@ -64,12 +64,12 @@ public:
get_info_results
get_info
(
const
get_info_params
&
)
const
;
struct
producer_info
{
name
name
;
name
producer_
name
;
};
struct
get_account_results
{
name
name
;
name
account_
name
;
asset
eos_balance
=
asset
(
0
,
EOS_SYMBOL
);
asset
staked_balance
;
asset
unstaking_balance
;
...
...
@@ -78,20 +78,20 @@ public:
optional
<
producer_info
>
producer
;
};
struct
get_account_params
{
name
name
;
name
account_
name
;
};
get_account_results
get_account
(
const
get_account_params
&
params
)
const
;
struct
get_code_results
{
name
name
;
name
account_
name
;
string
wast
;
fc
::
sha256
code_hash
;
optional
<
types
::
abi
>
abi
;
};
struct
get_code_params
{
name
name
;
name
account_
name
;
};
get_code_results
get_code
(
const
get_code_params
&
params
)
const
;
...
...
@@ -209,7 +209,7 @@ public:
const
auto
&
d
=
db
.
get_database
();
types
::
abi_serializer
abis
;
abis
.
set
A
bi
(
abi
);
abis
.
set
_a
bi
(
abi
);
const
auto
&
idx
=
d
.
get_index
<
IndexType
,
Scope
>
();
auto
lower
=
idx
.
lower_bound
(
boost
::
make_tuple
(
p
.
scope
,
p
.
code
,
p
.
table
)
);
...
...
@@ -321,11 +321,11 @@ FC_REFLECT( eosio::chain_apis::read_write::push_transaction_results, (transactio
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_table_rows_params
,
(
json
)(
table_key
)(
scope
)(
code
)(
table
)(
lower_bound
)(
upper_bound
)(
limit
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_table_rows_result
,
(
rows
)(
more
)
);
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_account_results
,
(
name
)(
eos_balance
)(
staked_balance
)(
unstaking_balance
)(
last_unstaking_time
)(
permissions
)(
producer
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_code_results
,
(
name
)(
code_hash
)(
wast
)(
abi
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_account_params
,
(
name
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_code_params
,
(
name
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
producer_info
,
(
name
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_account_results
,
(
account_
name
)(
eos_balance
)(
staked_balance
)(
unstaking_balance
)(
last_unstaking_time
)(
permissions
)(
producer
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_code_results
,
(
account_
name
)(
code_hash
)(
wast
)(
abi
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_account_params
,
(
account_
name
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_code_params
,
(
account_
name
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
producer_info
,
(
producer_
name
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
abi_json_to_bin_params
,
(
code
)(
action
)(
args
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
abi_json_to_bin_result
,
(
binargs
)(
required_scope
)(
required_auth
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
abi_bin_to_json_params
,
(
code
)(
action
)(
binargs
)
)
...
...
plugins/db_plugin/db_plugin.cpp
浏览文件 @
150184b0
...
...
@@ -190,11 +190,11 @@ namespace {
try
{
types
::
abi_serializer
abis
;
if
(
msg
.
code
==
config
::
eos_contract_name
)
{
abis
.
set
A
bi
(
db_plugin_impl
::
eos_abi
);
abis
.
set
_a
bi
(
db_plugin_impl
::
eos_abi
);
}
else
{
auto
from_account
=
find_account
(
accounts
,
msg
.
code
);
auto
abi
=
fc
::
json
::
from_string
(
bsoncxx
::
to_json
(
from_account
.
view
()[
"abi"
].
get_document
())).
as
<
types
::
abi
>
();
abis
.
set
A
bi
(
abi
);
abis
.
set
_a
bi
(
abi
);
}
auto
v
=
abis
.
binary_to_variant
(
abis
.
get_action_type
(
msg
.
type
),
msg
.
data
);
auto
json
=
fc
::
json
::
to_string
(
v
);
...
...
@@ -208,6 +208,10 @@ namespace {
}
}
catch
(
fc
::
exception
&
e
)
{
elog
(
"Unable to convert message.data to ABI type: ${t}, what: ${e}"
,
(
"t"
,
msg
.
type
)(
"e"
,
e
.
to_string
()));
}
catch
(
std
::
exception
&
e
)
{
elog
(
"Unable to convert message.data to ABI type: ${t}, std what: ${e}"
,
(
"t"
,
msg
.
type
)(
"e"
,
e
.
what
()));
}
catch
(...)
{
elog
(
"Unable to convert message.data to ABI type: ${t}"
,
(
"t"
,
msg
.
type
));
}
// if anything went wrong just store raw hex_data
msg_doc
.
append
(
kvp
(
"hex_data"
,
fc
::
variant
(
msg
.
data
).
as_string
()));
...
...
@@ -552,7 +556,7 @@ void db_plugin_impl::update_account(const chain::message& msg) {
document
update_from
{};
update_from
<<
"$set"
<<
open_document
<<
"abi"
<<
bsoncxx
::
from_json
(
fc
::
json
::
to_string
(
setcode
.
abi
))
<<
"abi"
<<
bsoncxx
::
from_json
(
fc
::
json
::
to_string
(
setcode
.
code_
abi
))
<<
"updatedAt"
<<
b_date
{
now
}
<<
close_document
;
...
...
programs/eosc/main.cpp
浏览文件 @
150184b0
...
...
@@ -387,7 +387,7 @@ struct set_account_permission_subcommand {
name
parent
;
if
(
parentStr
.
size
()
==
0
)
{
// see if we can auto-determine the proper parent
const
auto
account_result
=
call
(
get_account_func
,
fc
::
mutable_variant_object
(
"name"
,
accountStr
));
const
auto
account_result
=
call
(
get_account_func
,
fc
::
mutable_variant_object
(
"
account_
name"
,
accountStr
));
const
auto
&
existing_permissions
=
account_result
.
get_object
()[
"permissions"
].
get_array
();
auto
permissionPredicate
=
[
this
](
const
auto
&
perm
)
{
return
perm
.
is_object
()
&&
...
...
@@ -540,7 +540,7 @@ int main( int argc, char** argv ) {
getAccount
->
add_option
(
"name"
,
accountName
,
localized
(
"The name of the account to retrieve"
))
->
required
();
getAccount
->
set_callback
([
&
]
{
std
::
cout
<<
fc
::
json
::
to_pretty_string
(
call
(
get_account_func
,
fc
::
mutable_variant_object
(
"name"
,
accountName
)))
fc
::
mutable_variant_object
(
"
account_
name"
,
accountName
)))
<<
std
::
endl
;
});
...
...
@@ -552,7 +552,7 @@ int main( int argc, char** argv ) {
getCode
->
add_option
(
"-c,--code"
,
codeFilename
,
localized
(
"The name of the file to save the contract .wast to"
)
);
getCode
->
add_option
(
"-a,--abi"
,
abiFilename
,
localized
(
"The name of the file to save the contract .abi to"
)
);
getCode
->
set_callback
([
&
]
{
auto
result
=
call
(
get_code_func
,
fc
::
mutable_variant_object
(
"name"
,
accountName
));
auto
result
=
call
(
get_code_func
,
fc
::
mutable_variant_object
(
"
account_
name"
,
accountName
));
std
::
cout
<<
localized
(
"code hash: ${code_hash}"
,
(
"code_hash"
,
result
[
"code_hash"
].
as_string
()))
<<
std
::
endl
;
...
...
@@ -686,7 +686,7 @@ int main( int argc, char** argv ) {
handler
.
account
=
account
;
handler
.
code
.
assign
(
wasm
.
begin
(),
wasm
.
end
());
if
(
abi
->
count
())
handler
.
abi
=
fc
::
json
::
from_file
(
abiPath
).
as
<
types
::
abi
>
();
handler
.
code_
abi
=
fc
::
json
::
from_file
(
abiPath
).
as
<
types
::
abi
>
();
signed_transaction
trx
;
trx
.
scope
=
sort_names
({
config
::
eos_contract_name
,
account
});
...
...
tests/api_tests/api_tests.cpp
浏览文件 @
150184b0
...
...
@@ -526,7 +526,7 @@ BOOST_FIXTURE_TEST_CASE(test_case_name, testing_fixture)
#define RUN_CODE_ABI_WITH_TRANSFER(account_name, test_wast, test_abi) \
types::setcode handler; \
handler.
abi = fc::json::from_string(test_abi).as<types::abi>();
\
handler.
code_abi = fc::json::from_string(test_abi).as<types::abi>();
\
RUN_CODE_HANDLER_WITH_TRANSFER(account_name, test_wast)
#define TEST_CASE_RUN_CODE_ABI_W_XFER(test_case_name, account_name, test_wast, test_abi) \
...
...
tests/tests/abi_tests.cpp
浏览文件 @
150184b0
...
...
@@ -446,7 +446,7 @@ BOOST_FIXTURE_TEST_CASE(abi_cycle, testing_fixture)
BOOST_CHECK_EXCEPTION
(
abis
.
validate
(),
fc
::
assert_exception
,
is_assert_exception
);
abi
=
fc
::
json
::
from_string
(
struct_cycle_abi
).
as
<
types
::
abi
>
();
abis
.
setA
bi
(
abi
);
abis
.
set_a
bi
(
abi
);
BOOST_CHECK_EXCEPTION
(
abis
.
validate
(),
fc
::
assert_exception
,
is_assert_exception
);
}
FC_LOG_AND_RETHROW
()
}
...
...
@@ -751,7 +751,7 @@ BOOST_FIXTURE_TEST_CASE(updateauth, testing_fixture)
"account" : "updauth.acct",
"permission" : "updauth.prm",
"parent" : "updauth.prnt",
"authority" : {
"
new_
authority" : {
"threshold" : "2147483145",
"keys" : [ {"key" : "EOS65rXebLhtk2aTTzP4e9x1AQZs7c5NNXJp89W8R3HyaA6Zyd4im", "weight" : 57005},
{"key" : "EOS5eVr9TVnqwnUBNwf9kwMTbrHvX5aPyyEG97dz2b2TNeqWRzbJf", "weight" : 57605} ],
...
...
@@ -767,21 +767,21 @@ BOOST_FIXTURE_TEST_CASE(updateauth, testing_fixture)
BOOST_CHECK_EQUAL
(
"updauth.acct"
,
updateauth
.
account
);
BOOST_CHECK_EQUAL
(
"updauth.prm"
,
updateauth
.
permission
);
BOOST_CHECK_EQUAL
(
"updauth.prnt"
,
updateauth
.
parent
);
BOOST_CHECK_EQUAL
(
2147483145u
,
updateauth
.
authority
.
threshold
);
BOOST_REQUIRE_EQUAL
(
2
,
updateauth
.
authority
.
keys
.
size
());
BOOST_CHECK_EQUAL
(
"EOS65rXebLhtk2aTTzP4e9x1AQZs7c5NNXJp89W8R3HyaA6Zyd4im"
,
(
std
::
string
)
updateauth
.
authority
.
keys
[
0
].
key
);
BOOST_CHECK_EQUAL
(
57005u
,
updateauth
.
authority
.
keys
[
0
].
weight
);
BOOST_CHECK_EQUAL
(
"EOS5eVr9TVnqwnUBNwf9kwMTbrHvX5aPyyEG97dz2b2TNeqWRzbJf"
,
(
std
::
string
)
updateauth
.
authority
.
keys
[
1
].
key
);
BOOST_CHECK_EQUAL
(
57605u
,
updateauth
.
authority
.
keys
[
1
].
weight
);
BOOST_REQUIRE_EQUAL
(
2
,
updateauth
.
authority
.
accounts
.
size
());
BOOST_CHECK_EQUAL
(
"prm.acct1"
,
updateauth
.
authority
.
accounts
[
0
].
permission
.
account
);
BOOST_CHECK_EQUAL
(
"prm.prm1"
,
updateauth
.
authority
.
accounts
[
0
].
permission
.
permission
);
BOOST_CHECK_EQUAL
(
53005u
,
updateauth
.
authority
.
accounts
[
0
].
weight
);
BOOST_CHECK_EQUAL
(
"prm.acct2"
,
updateauth
.
authority
.
accounts
[
1
].
permission
.
account
);
BOOST_CHECK_EQUAL
(
"prm.prm2"
,
updateauth
.
authority
.
accounts
[
1
].
permission
.
permission
);
BOOST_CHECK_EQUAL
(
53405u
,
updateauth
.
authority
.
accounts
[
1
].
weight
);
BOOST_CHECK_EQUAL
(
2147483145u
,
updateauth
.
new_
authority
.
threshold
);
BOOST_REQUIRE_EQUAL
(
2
,
updateauth
.
new_
authority
.
keys
.
size
());
BOOST_CHECK_EQUAL
(
"EOS65rXebLhtk2aTTzP4e9x1AQZs7c5NNXJp89W8R3HyaA6Zyd4im"
,
(
std
::
string
)
updateauth
.
new_
authority
.
keys
[
0
].
key
);
BOOST_CHECK_EQUAL
(
57005u
,
updateauth
.
new_
authority
.
keys
[
0
].
weight
);
BOOST_CHECK_EQUAL
(
"EOS5eVr9TVnqwnUBNwf9kwMTbrHvX5aPyyEG97dz2b2TNeqWRzbJf"
,
(
std
::
string
)
updateauth
.
new_
authority
.
keys
[
1
].
key
);
BOOST_CHECK_EQUAL
(
57605u
,
updateauth
.
new_
authority
.
keys
[
1
].
weight
);
BOOST_REQUIRE_EQUAL
(
2
,
updateauth
.
new_
authority
.
accounts
.
size
());
BOOST_CHECK_EQUAL
(
"prm.acct1"
,
updateauth
.
new_
authority
.
accounts
[
0
].
permission
.
account
);
BOOST_CHECK_EQUAL
(
"prm.prm1"
,
updateauth
.
new_
authority
.
accounts
[
0
].
permission
.
permission
);
BOOST_CHECK_EQUAL
(
53005u
,
updateauth
.
new_
authority
.
accounts
[
0
].
weight
);
BOOST_CHECK_EQUAL
(
"prm.acct2"
,
updateauth
.
new_
authority
.
accounts
[
1
].
permission
.
account
);
BOOST_CHECK_EQUAL
(
"prm.prm2"
,
updateauth
.
new_
authority
.
accounts
[
1
].
permission
.
permission
);
BOOST_CHECK_EQUAL
(
53405u
,
updateauth
.
new_
authority
.
accounts
[
1
].
weight
);
auto
var2
=
verify_round_trip_conversion
(
abis
,
"updateauth"
,
var
);
auto
updateauth2
=
var2
.
as
<
eosio
::
types
::
updateauth
>
();
...
...
@@ -789,21 +789,21 @@ BOOST_FIXTURE_TEST_CASE(updateauth, testing_fixture)
BOOST_CHECK_EQUAL
(
updateauth
.
permission
,
updateauth2
.
permission
);
BOOST_CHECK_EQUAL
(
updateauth
.
parent
,
updateauth2
.
parent
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
threshold
,
updateauth2
.
authority
.
threshold
);
BOOST_REQUIRE_EQUAL
(
updateauth
.
authority
.
keys
.
size
(),
updateauth2
.
authority
.
keys
.
size
());
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
keys
[
0
].
key
,
updateauth2
.
authority
.
keys
[
0
].
key
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
keys
[
0
].
weight
,
updateauth2
.
authority
.
keys
[
0
].
weight
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
keys
[
1
].
key
,
updateauth2
.
authority
.
keys
[
1
].
key
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
keys
[
1
].
weight
,
updateauth2
.
authority
.
keys
[
1
].
weight
);
BOOST_REQUIRE_EQUAL
(
updateauth
.
authority
.
accounts
.
size
(),
updateauth2
.
authority
.
accounts
.
size
());
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
accounts
[
0
].
permission
.
account
,
updateauth2
.
authority
.
accounts
[
0
].
permission
.
account
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
accounts
[
0
].
permission
.
permission
,
updateauth2
.
authority
.
accounts
[
0
].
permission
.
permission
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
accounts
[
0
].
weight
,
updateauth2
.
authority
.
accounts
[
0
].
weight
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
accounts
[
1
].
permission
.
account
,
updateauth2
.
authority
.
accounts
[
1
].
permission
.
account
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
accounts
[
1
].
permission
.
permission
,
updateauth2
.
authority
.
accounts
[
1
].
permission
.
permission
);
BOOST_CHECK_EQUAL
(
updateauth
.
authority
.
accounts
[
1
].
weight
,
updateauth2
.
authority
.
accounts
[
1
].
weight
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
threshold
,
updateauth2
.
new_
authority
.
threshold
);
BOOST_REQUIRE_EQUAL
(
updateauth
.
new_authority
.
keys
.
size
(),
updateauth2
.
new_
authority
.
keys
.
size
());
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
keys
[
0
].
key
,
updateauth2
.
new_
authority
.
keys
[
0
].
key
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
keys
[
0
].
weight
,
updateauth2
.
new_
authority
.
keys
[
0
].
weight
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
keys
[
1
].
key
,
updateauth2
.
new_
authority
.
keys
[
1
].
key
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
keys
[
1
].
weight
,
updateauth2
.
new_
authority
.
keys
[
1
].
weight
);
BOOST_REQUIRE_EQUAL
(
updateauth
.
new_authority
.
accounts
.
size
(),
updateauth2
.
new_
authority
.
accounts
.
size
());
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
accounts
[
0
].
permission
.
account
,
updateauth2
.
new_
authority
.
accounts
[
0
].
permission
.
account
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
accounts
[
0
].
permission
.
permission
,
updateauth2
.
new_
authority
.
accounts
[
0
].
permission
.
permission
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
accounts
[
0
].
weight
,
updateauth2
.
new_
authority
.
accounts
[
0
].
weight
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
accounts
[
1
].
permission
.
account
,
updateauth2
.
new_
authority
.
accounts
[
1
].
permission
.
account
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
accounts
[
1
].
permission
.
permission
,
updateauth2
.
new_
authority
.
accounts
[
1
].
permission
.
permission
);
BOOST_CHECK_EQUAL
(
updateauth
.
new_authority
.
accounts
[
1
].
weight
,
updateauth2
.
new_
authority
.
accounts
[
1
].
weight
);
}
FC_LOG_AND_RETHROW
()
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录