Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
65243c7c
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,发现更多精彩内容 >>
提交
65243c7c
编写于
5月 16, 2018
作者:
A
Anton Perkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
small refactoring #1962
上级
fbf611b4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
33 deletion
+35
-33
unittests/eosio.system_tests.cpp
unittests/eosio.system_tests.cpp
+35
-33
未找到文件。
unittests/eosio.system_tests.cpp
浏览文件 @
65243c7c
...
...
@@ -50,27 +50,6 @@ public:
issue
(
config
::
system_account_name
,
"1000000000.0000 EOS"
);
BOOST_REQUIRE_EQUAL
(
asset
::
from_string
(
"1000000000.0000 EOS"
),
get_balance
(
"eosio"
)
);
//install multisig contract
{
create_accounts
(
{
N
(
eosio
.
msig
)
}
);
produce_block
();
auto
trace
=
base_tester
::
push_action
(
config
::
system_account_name
,
N
(
setpriv
),
config
::
system_account_name
,
mutable_variant_object
()
(
"account"
,
"eosio.msig"
)
(
"is_priv"
,
1
)
);
set_code
(
N
(
eosio
.
msig
),
eosio_msig_wast
);
set_abi
(
N
(
eosio
.
msig
),
eosio_msig_abi
);
produce_blocks
();
const
auto
&
accnt
=
control
->
db
().
get
<
account_object
,
by_name
>
(
N
(
eosio
.
msig
)
);
abi_def
msig_abi
;
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
msig_abi
),
true
);
msig_abi_ser
.
set_abi
(
msig_abi
);
}
set_code
(
config
::
system_account_name
,
eosio_system_wast
);
set_abi
(
config
::
system_account_name
,
eosio_system_abi
);
...
...
@@ -421,20 +400,8 @@ public:
transaction
upgrade_system_contract
(
const
vector
<
uint8_t
>&
code
);
action_result
push_action_msig
(
const
account_name
&
signer
,
const
action_name
&
name
,
const
variant_object
&
data
,
bool
auth
=
true
)
{
string
action_type_name
=
msig_abi_ser
.
get_action_type
(
name
);
action
act
;
act
.
account
=
N
(
eosio
.
msig
);
act
.
name
=
name
;
act
.
data
=
msig_abi_ser
.
variant_to_binary
(
action_type_name
,
data
);
return
base_tester
::
push_action
(
std
::
move
(
act
),
auth
?
uint64_t
(
signer
)
:
signer
==
N
(
bob111111111
)
?
N
(
alice1111111
)
:
N
(
bob111111111
)
);
}
abi_serializer
abi_ser
;
abi_serializer
token_abi_ser
;
abi_serializer
msig_abi_ser
;
};
transaction
eosio_system_tester
::
upgrade_system_contract
(
const
vector
<
uint8_t
>&
code
)
{
...
...
@@ -1899,6 +1866,29 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
}
FC_LOG_AND_RETHROW
()
BOOST_FIXTURE_TEST_CASE
(
producers_upgrade_system_contract
,
eosio_system_tester
)
try
{
//install multisig contract
abi_serializer
msig_abi_ser
;
{
create_account_with_resources
(
N
(
eosio
.
msig
),
N
(
eosio
)
);
BOOST_REQUIRE_EQUAL
(
success
(),
buyram
(
"eosio"
,
"eosio.msig"
,
"5000.0000 EOS"
)
);
produce_block
();
auto
trace
=
base_tester
::
push_action
(
config
::
system_account_name
,
N
(
setpriv
),
config
::
system_account_name
,
mutable_variant_object
()
(
"account"
,
"eosio.msig"
)
(
"is_priv"
,
1
)
);
set_code
(
N
(
eosio
.
msig
),
eosio_msig_wast
);
set_abi
(
N
(
eosio
.
msig
),
eosio_msig_abi
);
produce_blocks
();
const
auto
&
accnt
=
control
->
db
().
get
<
account_object
,
by_name
>
(
N
(
eosio
.
msig
)
);
abi_def
msig_abi
;
BOOST_REQUIRE_EQUAL
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
msig_abi
),
true
);
msig_abi_ser
.
set_abi
(
msig_abi
);
}
//stake more than 15% of total EOS supply to activate chain
transfer
(
"eosio"
,
"alice1111111"
,
"650000000.0000 EOS"
,
"eosio"
);
BOOST_REQUIRE_EQUAL
(
success
(),
stake
(
"alice1111111"
,
"alice1111111"
,
"300000000.0000 EOS"
,
"300000000.0000 EOS"
)
);
...
...
@@ -1951,6 +1941,18 @@ BOOST_FIXTURE_TEST_CASE(producers_upgrade_system_contract, eosio_system_tester)
BOOST_REQUIRE_EQUAL
(
21
,
producer_keys
.
size
()
);
BOOST_REQUIRE_EQUAL
(
name
(
"defproducera"
),
producer_keys
[
0
].
producer_name
);
//helper function
auto
push_action_msig
=
[
&
](
const
account_name
&
signer
,
const
action_name
&
name
,
const
variant_object
&
data
,
bool
auth
=
true
)
->
action_result
{
string
action_type_name
=
msig_abi_ser
.
get_action_type
(
name
);
action
act
;
act
.
account
=
N
(
eosio
.
msig
);
act
.
name
=
name
;
act
.
data
=
msig_abi_ser
.
variant_to_binary
(
action_type_name
,
data
);
return
base_tester
::
push_action
(
std
::
move
(
act
),
auth
?
uint64_t
(
signer
)
:
signer
==
N
(
bob111111111
)
?
N
(
alice1111111
)
:
N
(
bob111111111
)
);
};
// test begins
vector
<
permission_level
>
prod_perms
;
for
(
auto
&
x
:
producer_names
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录