Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
4a79aead
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,发现更多精彩内容 >>
提交
4a79aead
编写于
3月 08, 2018
作者:
A
Anton Perkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
unregister producer, more tests for system contracts, change in static_variant reverted
上级
c75a6ff1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
77 addition
and
13 deletion
+77
-13
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+10
-1
contracts/eosio.system/voting.hpp
contracts/eosio.system/voting.hpp
+25
-6
contracts/eosiolib/privileged.hpp
contracts/eosiolib/privileged.hpp
+1
-1
libraries/fc/include/fc/static_variant.hpp
libraries/fc/include/fc/static_variant.hpp
+1
-1
tests/wasm_tests/eosio.system_tests.cpp
tests/wasm_tests/eosio.system_tests.cpp
+40
-4
未找到文件。
contracts/eosio.system/eosio.system.abi
浏览文件 @
4a79aead
...
...
@@ -95,13 +95,22 @@
{"name":"inflation_rate", "type":"uint32"},
{"name":"storage_reserve_ratio", "type":"uint32"},
]
},
,
{
},{
"name": "eosio_global_state",
"base": "eosio_parameters",
"fields": [
{"name":"total_storage_bytes_reserved", "type":"uint64"},
{"name":"total_storage_stake", "type":"uint64"}
]
},{
"name": "producer_info",
"base": "",
"fields": [
{"name":"owner", "type":"uint64"},
{"name":"total_votes", "type":"uint128"},
{"name":"prefs", "type":"eosio_parameters"},
{"name":"packed_key", "type":"uint8[]"}
]
},{
"name": "regproducer",
"base": "",
...
...
contracts/eosio.system/voting.hpp
浏览文件 @
4a79aead
...
...
@@ -43,11 +43,11 @@ namespace eosiosystem {
static
constexpr
uint32_t
unstake_payments
=
26
;
// during 26 weeks
struct
producer_info
{
account_name
owner
;
uint64_t
padding
=
0
;
uint128_t
total_votes
=
0
;
account_name
owner
;
uint64_t
padding
=
0
;
uint128_t
total_votes
=
0
;
eosio_parameters
prefs
;
eosio
::
bytes
packed_key
;
/// a packed public key object
eosio
::
bytes
packed_key
;
/// a packed public key object
uint64_t
primary_key
()
const
{
return
owner
;
}
uint128_t
by_votes
()
const
{
return
total_votes
;
}
...
...
@@ -82,8 +82,8 @@ namespace eosiosystem {
typedef
eosio
::
multi_index
<
N
(
voters
),
voter_info
>
voters_table
;
ACTION
(
SystemAccount
,
regproducer
)
{
account_name
producer
;
bytes
producer_key
;
account_name
producer
;
bytes
producer_key
;
eosio_parameters
prefs
;
EOSLIB_SERIALIZE
(
regproducer
,
(
producer
)(
producer_key
)(
prefs
)
)
...
...
@@ -106,6 +106,7 @@ namespace eosiosystem {
if
(
prod
)
{
producers_tbl
.
update
(
*
prod
,
reg
.
producer
,
[
&
](
producer_info
&
info
){
info
.
prefs
=
reg
.
prefs
;
info
.
packed_key
=
reg
.
producer_key
;
});
}
else
{
producers_tbl
.
emplace
(
reg
.
producer
,
[
&
](
producer_info
&
info
){
...
...
@@ -117,6 +118,24 @@ namespace eosiosystem {
}
}
ACTION
(
SystemAccount
,
unregproducer
)
{
account_name
producer
;
EOSLIB_SERIALIZE
(
unregproducer
,
(
producer
)
)
};
static
void
on
(
const
unregproducer
&
unreg
)
{
require_auth
(
unreg
.
producer
);
producers_table
producers_tbl
(
SystemAccount
,
SystemAccount
);
const
auto
*
prod
=
producers_tbl
.
find
(
unreg
.
producer
);
eosio_assert
(
bool
(
prod
),
"producer not found"
);
producers_tbl
.
update
(
*
prod
,
0
,
[
&
](
producer_info
&
info
){
info
.
packed_key
.
clear
();
});
}
ACTION
(
SystemAccount
,
stakevote
)
{
account_name
voter
;
system_token_type
amount
;
...
...
contracts/eosiolib/privileged.hpp
浏览文件 @
4a79aead
...
...
@@ -5,7 +5,7 @@
namespace
eosio
{
struct
blockchain_parameters
:
::
blockchain_parameters
{
EOSLIB_SERIALIZE
(
blockchain_parameters
,
(
target_block_size
)(
max_block_size
)(
target_block_acts_per_scope
)
(
max_block_acts_per_scope
)(
target_block_acts
)(
max_block_acts
)(
max_storage_size
)
(
max_transaction_lifetime
)(
max_transaction_exec_time
)(
max_authority_depth
)
...
...
libraries/fc/include/fc/static_variant.hpp
浏览文件 @
4a79aead
...
...
@@ -195,7 +195,7 @@ class static_variant {
static_assert
(
impl
::
type_info
<
Types
...
>::
no_reference_types
,
"Reference types are not permitted in static_variant."
);
static_assert
(
impl
::
type_info
<
Types
...
>::
no_duplicates
,
"static_variant type arguments contain duplicate types."
);
uint32_
t
_tag
;
in
t
_tag
;
char
storage
[
impl
::
type_info
<
Types
...
>::
size
];
template
<
typename
X
>
...
...
tests/wasm_tests/eosio.system_tests.cpp
浏览文件 @
4a79aead
...
...
@@ -74,7 +74,7 @@ public:
fc
::
variant
get_producer_info
(
const
account_name
&
act
)
{
vector
<
char
>
data
=
get_row_by_account
(
config
::
system_account_name
,
config
::
system_account_name
,
N
(
producerinfo
),
act
);
return
abi_ser
.
binary_to_variant
(
"
eosio_global_state
"
,
data
);
return
abi_ser
.
binary_to_variant
(
"
producer_info
"
,
data
);
}
abi_serializer
abi_ser
;
...
...
@@ -545,16 +545,52 @@ BOOST_FIXTURE_TEST_CASE( producer_register_unregister, eosio_system_tester ) try
(
"inflation_rate"
,
1051
)
(
"storage_reserve_ratio"
,
1005
);
vector
<
char
>
key
=
fc
::
raw
::
pack
(
fc
::
crypto
::
public_key
(
std
::
string
(
"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
)
)
);
BOOST_REQUIRE_EQUAL
(
success
(),
push_action
(
N
(
alice
),
N
(
regproducer
),
mvo
()
(
"producer"
,
"alice"
)
(
"producer_key"
,
fc
::
raw
::
pack
(
fc
::
crypto
::
public_key
(
std
::
string
(
"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
)
)
)
)
(
"producer_key"
,
key
)
(
"prefs"
,
params
)
)
);
auto
info
=
get_producer_info
(
"alice"
);
BOOST_REQUIRE_EQUAL
(
true
,
info
.
is_object
()
);
REQUIRE_EQUAL_OBJECTS
(
params
,
info
);
BOOST_REQUIRE_EQUAL
(
N
(
alice
),
info
[
"owner"
].
as_uint64
()
);
BOOST_REQUIRE_EQUAL
(
0
,
info
[
"total_votes"
].
as_uint64
()
);
REQUIRE_EQUAL_OBJECTS
(
params
,
info
[
"prefs"
]
);
BOOST_REQUIRE_EQUAL
(
string
(
key
.
begin
(),
key
.
end
()),
to_string
(
info
[
"packed_key"
])
);
//do regproducer again to change parameters
fc
::
variant
params2
=
mutable_variant_object
()
(
"target_block_size"
,
1024
*
1024
+
1
)
(
"max_block_size"
,
10
*
1024
+
1
)
(
"target_block_acts_per_scope"
,
1002
)
(
"max_block_acts_per_scope"
,
10002
)
(
"target_block_acts"
,
1102
)
(
"max_block_acts"
,
11002
)
(
"max_storage_size"
,
2002
)
(
"max_transaction_lifetime"
,
3602
)
(
"max_transaction_exec_time"
,
9997
)
(
"max_authority_depth"
,
7
)
(
"max_inline_depth"
,
5
)
(
"max_inline_action_size"
,
4095
)
(
"max_generated_transaction_size"
,
64
*
1025
)
(
"inflation_rate"
,
1052
)
(
"storage_reserve_ratio"
,
1006
);
vector
<
char
>
key2
=
fc
::
raw
::
pack
(
fc
::
crypto
::
public_key
(
std
::
string
(
"EOSR16EPHFSKVYHBjQgxVGQPrwCxTg7BbZ69H9i4gztN9deKTEXYne4"
)
)
);
BOOST_REQUIRE_EQUAL
(
success
(),
push_action
(
N
(
alice
),
N
(
regproducer
),
mvo
()
(
"producer"
,
"alice"
)
(
"producer_key"
,
key2
)
(
"prefs"
,
params2
)
)
);
info
=
get_producer_info
(
"alice"
);
BOOST_REQUIRE_EQUAL
(
N
(
alice
),
info
[
"owner"
].
as_uint64
()
);
BOOST_REQUIRE_EQUAL
(
0
,
info
[
"total_votes"
].
as_uint64
()
);
REQUIRE_EQUAL_OBJECTS
(
params2
,
info
[
"prefs"
]
);
BOOST_REQUIRE_EQUAL
(
string
(
key2
.
begin
(),
key2
.
end
()),
to_string
(
info
[
"packed_key"
])
);
}
FC_LOG_AND_RETHROW
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录