Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
74581363
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,发现更多精彩内容 >>
提交
74581363
编写于
7月 20, 2017
作者:
D
Daniel Larimer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix Name to string conversion, add new WASM hooks to test for notify and auth
上级
2729536b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
4 deletion
+29
-4
libraries/chain/chain_controller.cpp
libraries/chain/chain_controller.cpp
+1
-1
libraries/chain/include/eos/chain/message_handling_contexts.hpp
...ies/chain/include/eos/chain/message_handling_contexts.hpp
+2
-0
libraries/chain/message_handling_contexts.cpp
libraries/chain/message_handling_contexts.cpp
+18
-2
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+7
-0
libraries/types/include/eos/types/native.hpp
libraries/types/include/eos/types/native.hpp
+1
-1
未找到文件。
libraries/chain/chain_controller.cpp
浏览文件 @
74581363
...
@@ -607,7 +607,7 @@ void chain_controller::process_message( const Transaction& trx, const Message& m
...
@@ -607,7 +607,7 @@ void chain_controller::process_message( const Transaction& trx, const Message& m
apply_message
(
apply_ctx
);
apply_message
(
apply_ctx
);
for
(
const
auto
&
recipient
:
message
.
recipients
)
{
for
(
const
auto
&
recipient
:
message
.
recipients
)
{
if
(
recipient
==
message
.
code
)
continue
;
/// we already ran it above
FC_ASSERT
(
recipient
!=
message
.
code
,
"message::code handler is always called and shouldn't be included in recipient list"
);
try
{
try
{
apply_context
recipient_ctx
(
*
this
,
_db
,
trx
,
message
,
recipient
);
apply_context
recipient_ctx
(
*
this
,
_db
,
trx
,
message
,
recipient
);
validate_message_precondition
(
recipient_ctx
);
validate_message_precondition
(
recipient_ctx
);
...
...
libraries/chain/include/eos/chain/message_handling_contexts.hpp
浏览文件 @
74581363
...
@@ -30,6 +30,8 @@ public:
...
@@ -30,6 +30,8 @@ public:
void
require_authorization
(
const
types
::
AccountName
&
account
);
void
require_authorization
(
const
types
::
AccountName
&
account
);
void
require_scope
(
const
types
::
AccountName
&
account
)
const
;
void
require_scope
(
const
types
::
AccountName
&
account
)
const
;
void
require_recipient
(
const
types
::
AccountName
&
account
)
const
;
void
require_recipient
(
const
types
::
AccountName
&
account
)
const
;
bool
has_recipient
(
const
types
::
AccountName
&
account
)
const
;
bool
has_authorization
(
const
types
::
AccountName
&
account
)
const
;
bool
all_authorizations_used
()
const
;
bool
all_authorizations_used
()
const
;
const
chain_controller
&
controller
;
const
chain_controller
&
controller
;
...
...
libraries/chain/message_handling_contexts.cpp
浏览文件 @
74581363
...
@@ -8,6 +8,15 @@
...
@@ -8,6 +8,15 @@
namespace
eos
{
namespace
chain
{
namespace
eos
{
namespace
chain
{
bool
message_validate_context
::
has_authorization
(
const
types
::
AccountName
&
account
)
const
{
auto
itr
=
boost
::
find_if
(
msg
.
authorization
,
[
&
account
](
const
types
::
AccountPermission
&
ap
)
{
return
ap
.
account
==
account
;
});
return
itr
!=
msg
.
authorization
.
end
();
}
void
message_validate_context
::
require_authorization
(
const
types
::
AccountName
&
account
)
{
void
message_validate_context
::
require_authorization
(
const
types
::
AccountName
&
account
)
{
auto
itr
=
boost
::
find_if
(
msg
.
authorization
,
[
&
account
](
const
types
::
AccountPermission
&
ap
)
{
auto
itr
=
boost
::
find_if
(
msg
.
authorization
,
[
&
account
](
const
types
::
AccountPermission
&
ap
)
{
...
@@ -29,12 +38,19 @@ void message_validate_context::require_scope(const types::AccountName& account)c
...
@@ -29,12 +38,19 @@ void message_validate_context::require_scope(const types::AccountName& account)c
"Required scope ${scope} not declared by transaction"
,
(
"scope"
,
account
)
);
"Required scope ${scope} not declared by transaction"
,
(
"scope"
,
account
)
);
}
}
void
message_validate_context
::
require_recipient
(
const
types
::
AccountName
&
account
)
const
{
bool
message_validate_context
::
has_recipient
(
const
types
::
AccountName
&
account
)
const
{
if
(
msg
.
code
==
account
)
return
true
;
auto
itr
=
boost
::
find_if
(
msg
.
recipients
,
[
&
account
](
const
auto
&
recipient
)
{
auto
itr
=
boost
::
find_if
(
msg
.
recipients
,
[
&
account
](
const
auto
&
recipient
)
{
return
recipient
==
account
;
return
recipient
==
account
;
});
});
EOS_ASSERT
(
itr
!=
msg
.
recipients
.
end
(),
tx_missing_recipient
,
return
itr
!=
msg
.
recipients
.
end
();
}
void
message_validate_context
::
require_recipient
(
const
types
::
AccountName
&
account
)
const
{
EOS_ASSERT
(
has_recipient
(
account
),
tx_missing_recipient
,
"Required recipient ${recipient} not declared by message"
,
(
"recipient"
,
account
)(
"recipients"
,
msg
.
recipients
)
);
"Required recipient ${recipient} not declared by message"
,
(
"recipient"
,
account
)(
"recipients"
,
msg
.
recipients
)
);
}
}
...
...
libraries/chain/wasm_interface.cpp
浏览文件 @
74581363
...
@@ -149,6 +149,13 @@ DEFINE_INTRINSIC_FUNCTION1(env,requireNotice,requireNotice,none,i64,account) {
...
@@ -149,6 +149,13 @@ DEFINE_INTRINSIC_FUNCTION1(env,requireNotice,requireNotice,none,i64,account) {
wasm_interface
::
get
().
current_validate_context
->
require_recipient
(
account
);
wasm_interface
::
get
().
current_validate_context
->
require_recipient
(
account
);
}
}
DEFINE_INTRINSIC_FUNCTION1
(
env
,
hasRecipient
,
hasRecipient
,
i32
,
i64
,
account
)
{
return
wasm_interface
::
get
().
current_validate_context
->
has_recipient
(
account
);
}
DEFINE_INTRINSIC_FUNCTION1
(
env
,
hasAuth
,
hasAuth
,
i32
,
i64
,
account
)
{
return
wasm_interface
::
get
().
current_validate_context
->
has_authorization
(
account
);
}
DEFINE_INTRINSIC_FUNCTION1
(
env
,
requireScope
,
requireScope
,
none
,
i64
,
scope
)
{
DEFINE_INTRINSIC_FUNCTION1
(
env
,
requireScope
,
requireScope
,
none
,
i64
,
scope
)
{
wasm_interface
::
get
().
current_validate_context
->
require_scope
(
scope
);
wasm_interface
::
get
().
current_validate_context
->
require_scope
(
scope
);
}
}
...
...
libraries/types/include/eos/types/native.hpp
浏览文件 @
74581363
...
@@ -62,7 +62,7 @@ namespace eos { namespace types {
...
@@ -62,7 +62,7 @@ namespace eos { namespace types {
if
(
c
>=
'a'
&&
c
<=
'z'
)
if
(
c
>=
'a'
&&
c
<=
'z'
)
return
(
c
-
'a'
)
+
1
;
return
(
c
-
'a'
)
+
1
;
if
(
c
>=
'1'
&&
c
<=
'5'
)
if
(
c
>=
'1'
&&
c
<=
'5'
)
return
(
c
-
'1'
)
+
2
6
;
return
(
c
-
'1'
)
+
2
7
;
return
0
;
return
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录