Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
f7a17ee8
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,发现更多精彩内容 >>
提交
f7a17ee8
编写于
5月 30, 2018
作者:
K
Khaled Al-Hassanieh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete savings field from eosio_global_state
上级
aecf0890
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
22 deletion
+11
-22
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+0
-1
contracts/eosio.system/eosio.system.hpp
contracts/eosio.system/eosio.system.hpp
+1
-2
contracts/eosio.system/producer_pay.cpp
contracts/eosio.system/producer_pay.cpp
+0
-1
unittests/eosio.system_tests.cpp
unittests/eosio.system_tests.cpp
+10
-18
未找到文件。
contracts/eosio.system/eosio.system.abi
浏览文件 @
f7a17ee8
...
...
@@ -258,7 +258,6 @@
{"name":"last_pervote_bucket_fill", "type":"uint64"},
{"name":"pervote_bucket", "type":"int64"},
{"name":"perblock_bucket", "type":"int64"},
{"name":"savings", "type":"int64"},
{"name":"total_unpaid_blocks", "type":"uint32"},
{"name":"total_activated_stake", "type":"int64"},
{"name":"thresh_activated_stake_time", "type":"uint64"},
...
...
contracts/eosio.system/eosio.system.hpp
浏览文件 @
f7a17ee8
...
...
@@ -54,7 +54,6 @@ namespace eosiosystem {
uint64_t
last_pervote_bucket_fill
=
0
;
int64_t
pervote_bucket
=
0
;
int64_t
perblock_bucket
=
0
;
int64_t
savings
=
0
;
uint32_t
total_unpaid_blocks
=
0
;
/// all blocks which have been produced but not paid
int64_t
total_activated_stake
=
0
;
uint64_t
thresh_activated_stake_time
=
0
;
...
...
@@ -66,7 +65,7 @@ namespace eosiosystem {
// explicit serialization macro is not necessary, used here only to improve compilation time
EOSLIB_SERIALIZE_DERIVED
(
eosio_global_state
,
eosio_parameters
,
(
total_ram_bytes_reserved
)(
total_ram_stake
)
(
last_producer_schedule_update
)(
last_pervote_bucket_fill
)
(
pervote_bucket
)(
perblock_bucket
)(
savings
)(
total_unpaid_blocks
)(
total_activated_stake
)(
thresh_activated_stake_time
)
(
pervote_bucket
)(
perblock_bucket
)(
total_unpaid_blocks
)(
total_activated_stake
)(
thresh_activated_stake_time
)
(
last_producer_schedule_id
)(
last_producer_schedule_size
)(
total_producer_vote_weight
)(
last_name_close
)
)
};
...
...
contracts/eosio.system/producer_pay.cpp
浏览文件 @
f7a17ee8
...
...
@@ -103,7 +103,6 @@ namespace eosiosystem {
_gstate
.
pervote_bucket
+=
to_per_vote_pay
;
_gstate
.
perblock_bucket
+=
to_per_block_pay
;
_gstate
.
savings
+=
to_savings
;
_gstate
.
last_pervote_bucket_fill
=
ct
;
}
...
...
unittests/eosio.system_tests.cpp
浏览文件 @
f7a17ee8
...
...
@@ -1151,7 +1151,7 @@ BOOST_FIXTURE_TEST_CASE(producer_pay, eosio_system_tester, * boost::unit_test::t
const
uint64_t
initial_claim_time
=
initial_global_state
[
"last_pervote_bucket_fill"
].
as_uint64
();
const
int64_t
initial_pervote_bucket
=
initial_global_state
[
"pervote_bucket"
].
as
<
int64_t
>
();
const
int64_t
initial_perblock_bucket
=
initial_global_state
[
"perblock_bucket"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
initial_global_state
[
"savings"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
get_balance
(
N
(
eosio
.
saving
)).
get_amount
();
const
uint32_t
initial_tot_unpaid_blocks
=
initial_global_state
[
"total_unpaid_blocks"
].
as
<
uint32_t
>
();
prod
=
get_producer_info
(
"defproducera"
);
...
...
@@ -1170,7 +1170,7 @@ BOOST_FIXTURE_TEST_CASE(producer_pay, eosio_system_tester, * boost::unit_test::t
const
uint64_t
claim_time
=
global_state
[
"last_pervote_bucket_fill"
].
as_uint64
();
const
int64_t
pervote_bucket
=
global_state
[
"pervote_bucket"
].
as
<
int64_t
>
();
const
int64_t
perblock_bucket
=
global_state
[
"perblock_bucket"
].
as
<
int64_t
>
();
const
int64_t
savings
=
g
lobal_state
[
"savings"
].
as
<
int64_t
>
();
const
int64_t
savings
=
g
et_balance
(
N
(
eosio
.
saving
)).
get_amount
();
const
uint32_t
tot_unpaid_blocks
=
global_state
[
"total_unpaid_blocks"
].
as
<
uint32_t
>
();
...
...
@@ -1229,7 +1229,7 @@ BOOST_FIXTURE_TEST_CASE(producer_pay, eosio_system_tester, * boost::unit_test::t
const
uint64_t
initial_claim_time
=
initial_global_state
[
"last_pervote_bucket_fill"
].
as_uint64
();
const
int64_t
initial_pervote_bucket
=
initial_global_state
[
"pervote_bucket"
].
as
<
int64_t
>
();
const
int64_t
initial_perblock_bucket
=
initial_global_state
[
"perblock_bucket"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
initial_global_state
[
"savings"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
get_balance
(
N
(
eosio
.
saving
)).
get_amount
();
const
uint32_t
initial_tot_unpaid_blocks
=
initial_global_state
[
"total_unpaid_blocks"
].
as
<
uint32_t
>
();
const
double
initial_tot_vote_weight
=
initial_global_state
[
"total_producer_vote_weight"
].
as
<
double
>
();
...
...
@@ -1253,7 +1253,7 @@ BOOST_FIXTURE_TEST_CASE(producer_pay, eosio_system_tester, * boost::unit_test::t
const
uint64_t
claim_time
=
global_state
[
"last_pervote_bucket_fill"
].
as_uint64
();
const
int64_t
pervote_bucket
=
global_state
[
"pervote_bucket"
].
as
<
int64_t
>
();
const
int64_t
perblock_bucket
=
global_state
[
"perblock_bucket"
].
as
<
int64_t
>
();
const
int64_t
savings
=
g
lobal_state
[
"savings"
].
as
<
int64_t
>
();
const
int64_t
savings
=
g
et_balance
(
N
(
eosio
.
saving
)).
get_amount
();
const
uint32_t
tot_unpaid_blocks
=
global_state
[
"total_unpaid_blocks"
].
as
<
uint32_t
>
();
...
...
@@ -1295,7 +1295,7 @@ BOOST_FIXTURE_TEST_CASE(producer_pay, eosio_system_tester, * boost::unit_test::t
regproducer
(
N
(
defproducerb
));
regproducer
(
N
(
defproducerc
));
const
asset
initial_supply
=
get_token_supply
();
const
int64_t
initial_savings
=
get_
global_state
()[
"savings"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
get_
balance
(
N
(
eosio
.
saving
)).
get_amount
();
for
(
uint32_t
i
=
0
;
i
<
7
*
52
;
++
i
)
{
produce_block
(
fc
::
seconds
(
8
*
3600
));
BOOST_REQUIRE_EQUAL
(
success
(),
push_action
(
N
(
defproducerc
),
N
(
claimrewards
),
mvo
()(
"owner"
,
"defproducerc"
)));
...
...
@@ -1305,7 +1305,7 @@ BOOST_FIXTURE_TEST_CASE(producer_pay, eosio_system_tester, * boost::unit_test::t
BOOST_REQUIRE_EQUAL
(
success
(),
push_action
(
N
(
defproducera
),
N
(
claimrewards
),
mvo
()(
"owner"
,
"defproducera"
)));
}
const
asset
supply
=
get_token_supply
();
const
int64_t
savings
=
get_
global_state
()[
"savings"
].
as
<
int64_t
>
();
const
int64_t
savings
=
get_
balance
(
N
(
eosio
.
saving
)).
get_amount
();
// Amount issued per year is very close to the 5% inflation target. Small difference (500 tokens out of 50'000'000 issued)
// is due to compounding every 8 hours in this test as opposed to theoretical continuous compounding
BOOST_REQUIRE
(
500
*
10000
>
int64_t
(
double
(
initial_supply
.
get_amount
())
*
double
(
0.05
))
-
(
supply
.
get_amount
()
-
initial_supply
.
get_amount
()));
...
...
@@ -1453,10 +1453,9 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
const
uint64_t
initial_claim_time
=
initial_global_state
[
"last_pervote_bucket_fill"
].
as_uint64
();
const
int64_t
initial_pervote_bucket
=
initial_global_state
[
"pervote_bucket"
].
as
<
int64_t
>
();
const
int64_t
initial_perblock_bucket
=
initial_global_state
[
"perblock_bucket"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
initial_global_state
[
"savings"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
get_balance
(
N
(
eosio
.
saving
)).
get_amount
();
const
uint32_t
initial_tot_unpaid_blocks
=
initial_global_state
[
"total_unpaid_blocks"
].
as
<
uint32_t
>
();
const
asset
initial_supply
=
get_token_supply
();
const
asset
initial_saving_balance
=
get_balance
(
N
(
eosio
.
saving
));
const
asset
initial_bpay_balance
=
get_balance
(
N
(
eosio
.
bpay
));
const
asset
initial_vpay_balance
=
get_balance
(
N
(
eosio
.
vpay
));
const
asset
initial_balance
=
get_balance
(
prod_name
);
...
...
@@ -1468,10 +1467,9 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
const
uint64_t
claim_time
=
global_state
[
"last_pervote_bucket_fill"
].
as_uint64
();
const
int64_t
pervote_bucket
=
global_state
[
"pervote_bucket"
].
as
<
int64_t
>
();
const
int64_t
perblock_bucket
=
global_state
[
"perblock_bucket"
].
as
<
int64_t
>
();
const
int64_t
savings
=
g
lobal_state
[
"savings"
].
as
<
int64_t
>
();
const
int64_t
savings
=
g
et_balance
(
N
(
eosio
.
saving
)).
get_amount
();
const
uint32_t
tot_unpaid_blocks
=
global_state
[
"total_unpaid_blocks"
].
as
<
uint32_t
>
();
const
asset
supply
=
get_token_supply
();
const
asset
saving_balance
=
get_balance
(
N
(
eosio
.
saving
));
const
asset
bpay_balance
=
get_balance
(
N
(
eosio
.
bpay
));
const
asset
vpay_balance
=
get_balance
(
N
(
eosio
.
vpay
));
const
asset
balance
=
get_balance
(
prod_name
);
...
...
@@ -1484,8 +1482,6 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
BOOST_REQUIRE_EQUAL
(
int64_t
(
expected_supply_growth
),
supply
.
get_amount
()
-
initial_supply
.
get_amount
()
);
BOOST_REQUIRE_EQUAL
(
int64_t
(
expected_supply_growth
)
-
int64_t
(
expected_supply_growth
)
/
5
,
savings
-
initial_savings
);
BOOST_REQUIRE_EQUAL
(
int64_t
(
expected_supply_growth
)
-
int64_t
(
expected_supply_growth
)
/
5
,
saving_balance
.
get_amount
()
-
initial_saving_balance
.
get_amount
()
);
const
int64_t
expected_perblock_bucket
=
int64_t
(
double
(
initial_supply
.
get_amount
())
*
double
(
usecs_between_fills
)
*
(
0.25
*
cont_rate
/
5.
)
/
usecs_per_year
);
const
int64_t
expected_pervote_bucket
=
int64_t
(
double
(
initial_supply
.
get_amount
())
*
double
(
usecs_between_fills
)
*
(
0.75
*
cont_rate
/
5.
)
/
usecs_per_year
);
...
...
@@ -1534,10 +1530,9 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
const
uint64_t
initial_claim_time
=
initial_global_state
[
"last_pervote_bucket_fill"
].
as_uint64
();
const
int64_t
initial_pervote_bucket
=
initial_global_state
[
"pervote_bucket"
].
as
<
int64_t
>
();
const
int64_t
initial_perblock_bucket
=
initial_global_state
[
"perblock_bucket"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
initial_global_state
[
"savings"
].
as
<
int64_t
>
();
const
int64_t
initial_savings
=
get_balance
(
N
(
eosio
.
saving
)).
get_amount
();
const
uint32_t
initial_tot_unpaid_blocks
=
initial_global_state
[
"total_unpaid_blocks"
].
as
<
uint32_t
>
();
const
asset
initial_supply
=
get_token_supply
();
const
asset
initial_saving_balance
=
get_balance
(
N
(
eosio
.
saving
));
const
asset
initial_bpay_balance
=
get_balance
(
N
(
eosio
.
bpay
));
const
asset
initial_vpay_balance
=
get_balance
(
N
(
eosio
.
vpay
));
const
asset
initial_balance
=
get_balance
(
prod_name
);
...
...
@@ -1549,10 +1544,9 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
const
uint64_t
claim_time
=
global_state
[
"last_pervote_bucket_fill"
].
as_uint64
();
const
int64_t
pervote_bucket
=
global_state
[
"pervote_bucket"
].
as
<
int64_t
>
();
const
int64_t
perblock_bucket
=
global_state
[
"perblock_bucket"
].
as
<
int64_t
>
();
const
int64_t
savings
=
g
lobal_state
[
"savings"
].
as
<
int64_t
>
();
const
int64_t
savings
=
g
et_balance
(
N
(
eosio
.
saving
)).
get_amount
();
const
uint32_t
tot_unpaid_blocks
=
global_state
[
"total_unpaid_blocks"
].
as
<
uint32_t
>
();
const
asset
supply
=
get_token_supply
();
const
asset
saving_balance
=
get_balance
(
N
(
eosio
.
saving
));
const
asset
bpay_balance
=
get_balance
(
N
(
eosio
.
bpay
));
const
asset
vpay_balance
=
get_balance
(
N
(
eosio
.
vpay
));
const
asset
balance
=
get_balance
(
prod_name
);
...
...
@@ -1563,8 +1557,6 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
const
double
expected_supply_growth
=
initial_supply
.
get_amount
()
*
double
(
usecs_between_fills
)
*
cont_rate
/
usecs_per_year
;
BOOST_REQUIRE_EQUAL
(
int64_t
(
expected_supply_growth
),
supply
.
get_amount
()
-
initial_supply
.
get_amount
()
);
BOOST_REQUIRE_EQUAL
(
int64_t
(
expected_supply_growth
)
-
int64_t
(
expected_supply_growth
)
/
5
,
savings
-
initial_savings
);
BOOST_REQUIRE_EQUAL
(
int64_t
(
expected_supply_growth
)
-
int64_t
(
expected_supply_growth
)
/
5
,
saving_balance
.
get_amount
()
-
initial_saving_balance
.
get_amount
()
);
const
int64_t
expected_perblock_bucket
=
int64_t
(
double
(
initial_supply
.
get_amount
())
*
double
(
usecs_between_fills
)
*
(
0.25
*
cont_rate
/
5.
)
/
usecs_per_year
)
+
initial_perblock_bucket
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录