Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
cb3ca15c
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,发现更多精彩内容 >>
提交
cb3ca15c
编写于
1月 31, 2018
作者:
D
Daniel Larimer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding priviledged API check and registering calls
上级
1404de95
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
6 deletion
+24
-6
libraries/chain/apply_context.cpp
libraries/chain/apply_context.cpp
+1
-0
libraries/chain/contracts/chain_initializer.cpp
libraries/chain/contracts/chain_initializer.cpp
+1
-0
libraries/chain/include/eosio/chain/apply_context.hpp
libraries/chain/include/eosio/chain/apply_context.hpp
+1
-0
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+21
-6
未找到文件。
libraries/chain/apply_context.cpp
浏览文件 @
cb3ca15c
...
...
@@ -17,6 +17,7 @@ void apply_context::exec_one()
(
*
native
)(
*
this
);
}
else
{
const
auto
&
a
=
mutable_controller
.
get_database
().
get
<
account_object
,
by_name
>
(
receiver
);
privileged
=
a
.
privileged
;
if
(
a
.
code
.
size
()
>
0
)
{
// get code from cache
...
...
libraries/chain/contracts/chain_initializer.cpp
浏览文件 @
cb3ca15c
...
...
@@ -201,6 +201,7 @@ std::vector<action> chain_initializer::prepare_database( chain_controller& chain
db
.
create
<
account_object
>
([
this
,
&
name
](
account_object
&
a
)
{
a
.
name
=
name
;
a
.
creation_date
=
genesis
.
initial_timestamp
;
a
.
privileged
=
true
;
if
(
name
==
config
::
system_account_name
)
{
a
.
set_abi
(
eos_contract_abi
());
...
...
libraries/chain/include/eosio/chain/apply_context.hpp
浏览文件 @
cb3ca15c
...
...
@@ -100,6 +100,7 @@ class apply_context {
const
chainbase
::
database
&
db
;
///< database where state is stored
const
action
&
act
;
///< message being applied
account_name
receiver
;
///< the code that is currently running
bool
privileged
=
false
;
chain_controller
&
mutable_controller
;
chainbase
::
database
&
mutable_db
;
...
...
libraries/chain/wasm_interface.cpp
浏览文件 @
cb3ca15c
...
...
@@ -423,7 +423,11 @@ class context_aware_api {
class
privileged_api
:
public
context_aware_api
{
public:
using
context_aware_api
::
context_aware_api
;
privileged_api
(
wasm_interface
&
wasm
)
:
context_aware_api
(
wasm
)
{
FC_ASSERT
(
context
.
privileged
,
"${code} does not have permission to call this API"
,
(
"code"
,
context
.
receiver
)
);
}
/**
* This should schedule the feature to be activated once the
...
...
@@ -432,7 +436,7 @@ class privileged_api : public context_aware_api {
*
* Feature name should be base32 encoded name.
*/
void
activate_feature
(
u
int64_t
feature_name
)
{
void
activate_feature
(
int64_t
feature_name
)
{
FC_ASSERT
(
!
"Unsupported Harfork Detected"
);
}
...
...
@@ -442,13 +446,13 @@ class privileged_api : public context_aware_api {
* Irreversiblity by fork-database is not consensus safe, therefore, this defines
* irreversiblity only by block headers not by BFT short-cut.
*/
bool
is_feature_active
(
u
int64_t
feature_name
)
{
int
is_feature_active
(
int64_t
feature_name
)
{
return
false
;
}
void
set_resource_limits
(
account_name
account
,
uint64_t
ram_bytes
,
uint64_t
net_weight
,
u
int64_t
cpu_weight
,
u
int64_t
cpu_usec_per_period
)
{
int64_t
ram_bytes
,
int64_t
net_weight
,
int64_t
cpu_weight
,
int64_t
cpu_usec_per_period
)
{
auto
&
buo
=
context
.
db
.
get
<
bandwidth_usage_object
,
by_owner
>
(
account
);
FC_ASSERT
(
buo
.
db_usage
<=
ram_bytes
,
"attempt to free to much space"
);
...
...
@@ -474,7 +478,7 @@ class privileged_api : public context_aware_api {
uint64_t
&
ram_bytes
,
uint64_t
&
net_weight
,
uint64_t
cpu_weight
)
{
}
void
set_active_producers
(
const
array_ptr
<
const
char
>
packed_producer_schedule
,
size_t
datalen
)
{
void
set_active_producers
(
array_ptr
<
char
>
packed_producer_schedule
,
size_t
datalen
)
{
datastream
<
const
char
*>
ds
(
packed_producer_schedule
,
datalen
);
producer_schedule_type
psch
;
fc
::
raw
::
unpack
(
ds
,
psch
);
...
...
@@ -808,6 +812,17 @@ class transaction_api : public context_aware_api {
};
REGISTER_INTRINSICS
(
privileged_api
,
(
activate_feature
,
void
(
int64_t
))
(
is_feature_active
,
int
(
int64_t
))
(
set_resource_limits
,
void
(
int64_t
,
int64_t
,
int64_t
,
int64_t
,
int64_t
))
(
set_active_producers
,
void
(
int
,
int
))
(
is_privileged
,
int
(
int64_t
))
(
set_privileged
,
void
(
int64_t
,
int
))
(
freeze_account
,
void
(
int64_t
,
int
))
(
is_frozen
,
int
(
int64_t
))
);
REGISTER_INTRINSICS
(
producer_api
,
(
get_active_producers
,
int
(
int
,
int
))
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录