Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
df65f11f
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,发现更多精彩内容 >>
未验证
提交
df65f11f
编写于
4月 05, 2018
作者:
D
Daniel Larimer
提交者:
GitHub
4月 05, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2145 from wanderingbort/feature/2141-fix-producers-threshold
Fix for bad threshold on producers account
上级
223565e8
eeb54194
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
14 deletion
+28
-14
libraries/chain/chain_controller.cpp
libraries/chain/chain_controller.cpp
+17
-11
libraries/chain/contracts/chain_initializer.cpp
libraries/chain/contracts/chain_initializer.cpp
+1
-1
libraries/chain/include/eosio/chain/chain_controller.hpp
libraries/chain/include/eosio/chain/chain_controller.hpp
+1
-0
libraries/chain/include/eosio/chain/config.hpp
libraries/chain/include/eosio/chain/config.hpp
+7
-1
tests/tests/special_accounts_tests.cpp
tests/tests/special_accounts_tests.cpp
+2
-1
未找到文件。
libraries/chain/chain_controller.cpp
浏览文件 @
df65f11f
...
@@ -1486,20 +1486,25 @@ void chain_controller::update_global_properties(const signed_block& b) { try {
...
@@ -1486,20 +1486,25 @@ void chain_controller::update_global_properties(const signed_block& b) { try {
}
}
});
});
_update_producers_authority
();
auto
active_producers_authority
=
authority
(
config
::
producers_authority_threshold
,
{},
{});
for
(
auto
&
name
:
gpo
.
active_producers
.
producers
)
{
active_producers_authority
.
accounts
.
push_back
({{
name
.
producer_name
,
config
::
active_name
},
1
});
}
auto
&
po
=
_db
.
get
<
permission_object
,
by_owner
>
(
boost
::
make_tuple
(
config
::
producers_account_name
,
config
::
active_name
)
);
_db
.
modify
(
po
,[
active_producers_authority
]
(
permission_object
&
po
)
{
po
.
auth
=
active_producers_authority
;
});
}
}
}
FC_CAPTURE_AND_RETHROW
()
}
}
FC_CAPTURE_AND_RETHROW
()
}
void
chain_controller
::
_update_producers_authority
()
{
const
auto
&
gpo
=
get_global_properties
();
uint32_t
authority_threshold
=
EOS_PERCENT_CEIL
(
gpo
.
active_producers
.
producers
.
size
(),
config
::
producers_authority_threshold_pct
);
auto
active_producers_authority
=
authority
(
authority_threshold
,
{},
{});
for
(
auto
&
name
:
gpo
.
active_producers
.
producers
)
{
active_producers_authority
.
accounts
.
push_back
({{
name
.
producer_name
,
config
::
active_name
},
1
});
}
auto
&
po
=
_db
.
get
<
permission_object
,
by_owner
>
(
boost
::
make_tuple
(
config
::
producers_account_name
,
config
::
active_name
)
);
_db
.
modify
(
po
,[
active_producers_authority
]
(
permission_object
&
po
)
{
po
.
auth
=
active_producers_authority
;
});
}
void
chain_controller
::
add_checkpoints
(
const
flat_map
<
uint32_t
,
block_id_type
>&
checkpts
)
{
void
chain_controller
::
add_checkpoints
(
const
flat_map
<
uint32_t
,
block_id_type
>&
checkpts
)
{
for
(
const
auto
&
i
:
checkpts
)
for
(
const
auto
&
i
:
checkpts
)
_checkpoints
[
i
.
first
]
=
i
.
second
;
_checkpoints
[
i
.
first
]
=
i
.
second
;
...
@@ -1606,6 +1611,7 @@ void chain_controller::_initialize_chain(contracts::chain_initializer& starter)
...
@@ -1606,6 +1611,7 @@ void chain_controller::_initialize_chain(contracts::chain_initializer& starter)
_db
.
create
<
block_summary_object
>
([
&
](
block_summary_object
&
)
{});
_db
.
create
<
block_summary_object
>
([
&
](
block_summary_object
&
)
{});
starter
.
prepare_database
(
*
this
,
_db
);
starter
.
prepare_database
(
*
this
,
_db
);
_update_producers_authority
();
});
});
}
}
}
FC_CAPTURE_AND_RETHROW
()
}
}
FC_CAPTURE_AND_RETHROW
()
}
...
...
libraries/chain/contracts/chain_initializer.cpp
浏览文件 @
df65f11f
...
@@ -391,7 +391,7 @@ void chain_initializer::prepare_database( chain_controller& chain,
...
@@ -391,7 +391,7 @@ void chain_initializer::prepare_database( chain_controller& chain,
};
};
auto
empty_authority
=
authority
(
0
,
{},
{});
auto
empty_authority
=
authority
(
0
,
{},
{});
auto
active_producers_authority
=
authority
(
config
::
producers_authority_threshold
,
{},
{});
auto
active_producers_authority
=
authority
(
0
,
{},
{});
active_producers_authority
.
accounts
.
push_back
({{
config
::
system_account_name
,
config
::
active_name
},
1
});
active_producers_authority
.
accounts
.
push_back
({{
config
::
system_account_name
,
config
::
active_name
},
1
});
create_special_account
(
config
::
nobody_account_name
,
empty_authority
,
empty_authority
);
create_special_account
(
config
::
nobody_account_name
,
empty_authority
,
empty_authority
);
...
...
libraries/chain/include/eosio/chain/chain_controller.hpp
浏览文件 @
df65f11f
...
@@ -345,6 +345,7 @@ namespace eosio { namespace chain {
...
@@ -345,6 +345,7 @@ namespace eosio { namespace chain {
/// Reset the object graph in-memory
/// Reset the object graph in-memory
void
_initialize_indexes
();
void
_initialize_indexes
();
void
_initialize_chain
(
contracts
::
chain_initializer
&
starter
);
void
_initialize_chain
(
contracts
::
chain_initializer
&
starter
);
void
_update_producers_authority
();
producer_schedule_type
_calculate_producer_schedule
()
const
;
producer_schedule_type
_calculate_producer_schedule
()
const
;
const
shared_producer_schedule_type
&
_head_producer_schedule
()
const
;
const
shared_producer_schedule_type
&
_head_producer_schedule
()
const
;
...
...
libraries/chain/include/eosio/chain/config.hpp
浏览文件 @
df65f11f
...
@@ -58,9 +58,10 @@ const static uint16_t default_max_inline_depth = 4;
...
@@ -58,9 +58,10 @@ const static uint16_t default_max_inline_depth = 4;
const
static
uint32_t
default_max_inline_action_size
=
4
*
1024
;
const
static
uint32_t
default_max_inline_action_size
=
4
*
1024
;
const
static
uint32_t
default_max_gen_trx_size
=
64
*
1024
;
///
const
static
uint32_t
default_max_gen_trx_size
=
64
*
1024
;
///
const
static
uint32_t
default_max_gen_trx_count
=
16
;
///< the number of generated transactions per action
const
static
uint32_t
default_max_gen_trx_count
=
16
;
///< the number of generated transactions per action
const
static
uint32_t
producers_authority_threshold
=
14
;
const
static
uint32_t
rate_limiting_precision
=
1000
*
1000
;
const
static
uint32_t
rate_limiting_precision
=
1000
*
1000
;
const
static
uint32_t
producers_authority_threshold_pct
=
66
*
config
::
percent_1
;
const
static
uint16_t
max_recursion_depth
=
6
;
const
static
uint16_t
max_recursion_depth
=
6
;
const
static
uint32_t
default_base_per_transaction_net_usage
=
100
;
// 100 bytes minimum (for signature and misc overhead)
const
static
uint32_t
default_base_per_transaction_net_usage
=
100
;
// 100 bytes minimum (for signature and misc overhead)
...
@@ -108,3 +109,8 @@ template<typename Number>
...
@@ -108,3 +109,8 @@ template<typename Number>
Number
EOS_PERCENT
(
Number
value
,
uint32_t
percentage
)
{
Number
EOS_PERCENT
(
Number
value
,
uint32_t
percentage
)
{
return
value
*
percentage
/
eosio
::
chain
::
config
::
percent_100
;
return
value
*
percentage
/
eosio
::
chain
::
config
::
percent_100
;
}
}
template
<
typename
Number
>
Number
EOS_PERCENT_CEIL
(
Number
value
,
uint32_t
percentage
)
{
return
((
value
*
percentage
)
+
eosio
::
chain
::
config
::
percent_100
-
eosio
::
chain
::
config
::
percent_1
)
/
eosio
::
chain
::
config
::
percent_100
;
}
tests/tests/special_accounts_tests.cpp
浏览文件 @
df65f11f
...
@@ -54,7 +54,8 @@ BOOST_FIXTURE_TEST_CASE(accounts_exists, tester)
...
@@ -54,7 +54,8 @@ BOOST_FIXTURE_TEST_CASE(accounts_exists, tester)
auto
&
gpo
=
chain1_db
.
get
<
global_property_object
>
();
auto
&
gpo
=
chain1_db
.
get
<
global_property_object
>
();
const
auto
&
producers_active_authority
=
chain1_db
.
get
<
permission_object
,
by_owner
>
(
boost
::
make_tuple
(
config
::
producers_account_name
,
config
::
active_name
));
const
auto
&
producers_active_authority
=
chain1_db
.
get
<
permission_object
,
by_owner
>
(
boost
::
make_tuple
(
config
::
producers_account_name
,
config
::
active_name
));
BOOST_CHECK_EQUAL
(
producers_active_authority
.
auth
.
threshold
,
config
::
producers_authority_threshold
);
auto
expected_threshold
=
EOS_PERCENT_CEIL
(
gpo
.
active_producers
.
producers
.
size
(),
config
::
producers_authority_threshold_pct
);
BOOST_CHECK_EQUAL
(
producers_active_authority
.
auth
.
threshold
,
expected_threshold
);
BOOST_CHECK_EQUAL
(
producers_active_authority
.
auth
.
accounts
.
size
(),
gpo
.
active_producers
.
producers
.
size
());
BOOST_CHECK_EQUAL
(
producers_active_authority
.
auth
.
accounts
.
size
(),
gpo
.
active_producers
.
producers
.
size
());
BOOST_CHECK_EQUAL
(
producers_active_authority
.
auth
.
keys
.
size
(),
0
);
BOOST_CHECK_EQUAL
(
producers_active_authority
.
auth
.
keys
.
size
(),
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录