Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
7829b7af
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,发现更多精彩内容 >>
提交
7829b7af
编写于
4月 21, 2018
作者:
D
Daniel Larimer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cleaning up apply context
上级
68d1565c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
59 addition
and
33 deletion
+59
-33
libraries/chain/apply_context.cpp
libraries/chain/apply_context.cpp
+5
-2
libraries/chain/controller.cpp
libraries/chain/controller.cpp
+40
-13
libraries/chain/eosio_contract.cpp
libraries/chain/eosio_contract.cpp
+3
-3
libraries/chain/include/eosio/chain/apply_context.hpp
libraries/chain/include/eosio/chain/apply_context.hpp
+0
-1
libraries/chain/include/eosio/chain/block.hpp
libraries/chain/include/eosio/chain/block.hpp
+2
-3
libraries/chain/include/eosio/chain/contract_types.hpp
libraries/chain/include/eosio/chain/contract_types.hpp
+7
-2
libraries/chain/include/eosio/chain/trace.hpp
libraries/chain/include/eosio/chain/trace.hpp
+1
-0
libraries/chain/include/eosio/chain/transaction_context.hpp
libraries/chain/include/eosio/chain/transaction_context.hpp
+0
-1
libraries/chain/transaction_context.cpp
libraries/chain/transaction_context.cpp
+1
-0
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+0
-8
未找到文件。
libraries/chain/apply_context.cpp
浏览文件 @
7829b7af
...
...
@@ -81,6 +81,7 @@ void apply_context::exec()
ncontext
.
id
=
id
;
ncontext
.
processing_deadline
=
processing_deadline
;
ncontext
.
published_time
=
published_time
;
ncontext
.
exec
();
fc
::
move_append
(
executed
,
move
(
ncontext
.
executed
)
);
total_cpu_usage
+=
ncontext
.
total_cpu_usage
;
...
...
@@ -93,6 +94,7 @@ void apply_context::exec()
EOS_ASSERT
(
recurse_depth
<
config
::
max_recursion_depth
,
transaction_exception
,
"inline action recursion depth reached"
);
apply_context
ncontext
(
mutable_controller
,
_inline_actions
[
i
],
trx
,
recurse_depth
+
1
);
ncontext
.
processing_deadline
=
processing_deadline
;
ncontext
.
published_time
=
published_time
;
ncontext
.
id
=
id
;
ncontext
.
exec
();
fc
::
move_append
(
executed
,
move
(
ncontext
.
executed
)
);
...
...
@@ -219,8 +221,9 @@ void apply_context::schedule_deferred_transaction( deferred_transaction&& trx )
auto
id
=
trx
.
id
();
/// TODO: validate authority and delay
const
auto
&
tr
=
static_cast
<
const
transaction
&>
(
trx
);
auto
trx_size
=
fc
::
raw
::
pack_size
(
tr
x
);
auto
trx_size
=
fc
::
raw
::
pack_size
(
tr
);
auto
&
d
=
control
.
db
();
d
.
create
<
generated_transaction_object
>
(
[
&
](
auto
&
gtx
)
{
...
...
@@ -234,7 +237,7 @@ void apply_context::schedule_deferred_transaction( deferred_transaction&& trx )
gtx
.
packed_trx
.
resize
(
trx_size
);
fc
::
datastream
<
char
*>
ds
(
gtx
.
packed_trx
.
data
(),
trx_size
);
fc
::
raw
::
pack
(
ds
,
tr
x
);
fc
::
raw
::
pack
(
ds
,
tr
);
});
auto
&
rl
=
control
.
get_mutable_resource_limits_manager
();
...
...
libraries/chain/controller.cpp
浏览文件 @
7829b7af
...
...
@@ -302,23 +302,50 @@ struct controller_impl {
self
.
accepted_block
(
head
);
}
void
apply_onerror
(
const
generated_transaction_object
&
gto
)
{
/*
try {
signed_transaction etrx;
etrx.actions.emplace_back(vector<permission_level>{{gto.sender,config::active_name}},
contracts::onerror( gto.sender_id, gto.packed_trx.data(), gto.packed_trx.size()) );
db.remove( gto );
}
*/
}
transaction_trace_ptr
push_scheduled_transaction
(
const
generated_transaction_object
&
gto
)
{
fc
::
datastream
<
const
char
*>
ds
(
gto
.
packed_trx
.
data
(),
gto
.
packed_trx
.
size
()
);
deferred_transaction
dtrx
;
fc
::
raw
::
unpack
(
ds
,
dtrx
);
transaction_context
trx_context
(
self
,
dtrx
,
gto
.
trx_id
);
trx_context
.
processing_deadline
=
fc
::
time_point
::
now
()
+
conf
.
limits
.
max_push_transaction_us
;
trx_context
.
net_usage
=
0
;
trx_context
.
sender
=
gto
.
sender
;
trx_context
.
published
=
gto
.
published
;
trx_context
.
exec
();
auto
&
acts
=
pending
->
_actions
;
fc
::
move_append
(
acts
,
move
(
trx_context
.
executed
)
);
optional
<
fc
::
exception
>
except
;
try
{
signed_transaction
dtrx
;
fc
::
raw
::
unpack
(
ds
,
static_cast
<
transaction
&>
(
dtrx
)
);
transaction_context
trx_context
(
self
,
dtrx
,
gto
.
trx_id
);
trx_context
.
processing_deadline
=
fc
::
time_point
::
now
()
+
conf
.
limits
.
max_push_transaction_us
;
trx_context
.
published
=
gto
.
published
;
return
move
(
trx_context
.
trace
);
}
/*
trx_context.exec();
auto& acts = pending->_actions;
fc::move_append( acts, move(trx_context.executed) );
db.remove( gto );
pending->_pending_block_state->block->transactions.emplace_back( gto.trx_id );
pending->_pending_block_state->block->transactions.back().kcpu_usage = trx.total_cpu_usage;
return move(trx_context.trace);
*/
}
catch
(
const
fc
::
exception
&
e
)
{
except
=
e
;
}
if
(
except
)
{
apply_onerror
(
gto
);
}
return
transaction_trace_ptr
();
}
/// push_scheduled_transaction
transaction_trace_ptr
push_transaction
(
const
transaction_metadata_ptr
&
trx
)
{
unapplied_transactions
.
erase
(
trx
->
signed_id
);
...
...
libraries/chain/eosio_contract.cpp
浏览文件 @
7829b7af
...
...
@@ -356,8 +356,7 @@ void apply_eosio_unlinkauth(apply_context& context) {
}
void
apply_eosio_onerror
(
apply_context
&
context
)
{
FC_ASSERT
(
context
.
sender
!=
account_name
(),
"onerror action cannot be called directly"
);
context
.
require_recipient
(
context
.
sender
);
context
.
require_authorization
(
config
::
system_account_name
);
}
static
const
abi_serializer
&
get_abi_serializer
()
{
...
...
@@ -495,8 +494,9 @@ void apply_eosio_passrecovery(apply_context& context) {
// ensure this is only processed if it is a deferred transaction from the system account
// TODO: verify this works with any PRIVILEGED account
FC_ASSERT
(
context
.
sender
==
config
::
system_account_name
);
//
FC_ASSERT( context.sender == config::system_account_name );
context
.
require_authorization
(
account
);
context
.
require_authorization
(
config
::
system_account_name
);
auto
maybe_recovery
=
get_pending_recovery
(
context
,
account
);
FC_ASSERT
(
maybe_recovery
,
"No pending recovery found for account ${account}"
,
(
"account"
,
account
));
...
...
libraries/chain/include/eosio/chain/apply_context.hpp
浏览文件 @
7829b7af
...
...
@@ -578,7 +578,6 @@ class apply_context {
uint32_t
recurse_depth
;
// how deep inline actions can recurse
fc
::
time_point_sec
published_time
;
account_name
sender
;
fc
::
time_point
processing_deadline
;
vector
<
action_receipt
>
executed
;
...
...
libraries/chain/include/eosio/chain/block.hpp
浏览文件 @
7829b7af
...
...
@@ -14,8 +14,7 @@ namespace eosio { namespace chain {
executed
=
0
,
///< succeed, no error handler executed
soft_fail
=
1
,
///< objectively failed (not executed), error handler executed
hard_fail
=
2
,
///< objectively failed and error handler objectively failed thus no state change
delayed
=
3
,
///< transaction delayed/deferred/scheduled for future execution
implicit
=
4
///< transaction that is implied or implicit with the block generation (such as on block action)
delayed
=
3
///< transaction delayed/deferred/scheduled for future execution
};
transaction_receipt_header
()
:
status
(
hard_fail
){}
...
...
@@ -61,7 +60,7 @@ namespace eosio { namespace chain {
}
}
/// eosio::chain
FC_REFLECT_ENUM
(
eosio
::
chain
::
transaction_receipt
::
status_enum
,
(
executed
)(
soft_fail
)(
hard_fail
)(
delayed
)
(
implicit
)
)
(
executed
)(
soft_fail
)(
hard_fail
)(
delayed
)
)
FC_REFLECT
(
eosio
::
chain
::
transaction_receipt_header
,
(
status
)(
kcpu_usage
)(
net_usage_words
)
)
FC_REFLECT_DERIVED
(
eosio
::
chain
::
transaction_receipt
,
(
eosio
::
chain
::
transaction_receipt_header
),
(
trx
)
)
...
...
libraries/chain/include/eosio/chain/contract_types.hpp
浏览文件 @
7829b7af
...
...
@@ -219,8 +219,12 @@ struct unlinkauth {
}
};
struct
onerror
:
bytes
{
using
bytes
::
bytes
;
struct
onerror
{
uint128_t
sender_id
;
bytes
sent_trx
;
onerror
(
uint128_t
sid
,
const
char
*
data
,
size_t
len
)
:
sender_id
(
sid
),
sent_trx
(
data
,
data
+
len
){}
static
account_name
get_account
()
{
return
config
::
system_account_name
;
...
...
@@ -304,3 +308,4 @@ FC_REFLECT( eosio::chain::postrecovery , (account)(auth)(mem
FC_REFLECT
(
eosio
::
chain
::
passrecovery
,
(
account
)
)
FC_REFLECT
(
eosio
::
chain
::
vetorecovery
,
(
account
)
)
FC_REFLECT
(
eosio
::
chain
::
canceldelay
,
(
canceling_auth
)(
trx_id
)
)
FC_REFLECT
(
eosio
::
chain
::
onerror
,
(
sender_id
)(
sent_trx
)
)
libraries/chain/include/eosio/chain/trace.hpp
浏览文件 @
7829b7af
...
...
@@ -29,6 +29,7 @@ namespace eosio { namespace chain {
transaction_receipt_header
receipt
;
fc
::
microseconds
elapsed
;
uint64_t
cpu_usage
=
0
;
bool
scheduled
=
false
;
vector
<
action_trace
>
action_traces
;
///< disposable
};
typedef
std
::
shared_ptr
<
transaction_trace
>
transaction_trace_ptr
;
...
...
libraries/chain/include/eosio/chain/transaction_context.hpp
浏览文件 @
7829b7af
...
...
@@ -31,7 +31,6 @@ namespace eosio { namespace chain {
controller
&
control
;
transaction_id_type
id
;
account_name
sender
;
fc
::
time_point
published
;
const
signed_transaction
&
trx
;
uint32_t
net_usage
=
0
;
...
...
libraries/chain/transaction_context.cpp
浏览文件 @
7829b7af
...
...
@@ -41,6 +41,7 @@ namespace eosio { namespace chain {
acontext
.
context_free
=
context_free
;
acontext
.
receiver
=
receiver
;
acontext
.
processing_deadline
=
processing_deadline
;
acontext
.
published_time
=
published
;
acontext
.
exec
();
fc
::
move_append
(
executed
,
move
(
acontext
.
executed
)
);
...
...
libraries/chain/wasm_interface.cpp
浏览文件 @
7829b7af
...
...
@@ -833,10 +833,6 @@ class action_api : public context_aware_api {
return
context
.
published_time
;
}
name
current_sender
()
{
return
context
.
sender
;
}
name
current_receiver
()
{
return
context
.
receiver
;
}
...
...
@@ -1546,13 +1542,10 @@ REGISTER_INTRINSICS(action_api,
(
read_action_data
,
int
(
int
,
int
)
)
(
action_data_size
,
int
()
)
(
publication_time
,
int32_t
()
)
(
current_sender
,
int64_t
()
)
(
current_receiver
,
int64_t
()
)
);
REGISTER_INTRINSICS
(
apply_context
,
// (require_write_lock, void(int64_t) )
// (require_read_lock, void(int64_t, int64_t) )
(
require_recipient
,
void
(
int64_t
)
)
(
require_authorization
,
void
(
int64_t
),
"require_auth"
,
void
(
apply_context
::*
)(
const
account_name
&
))
(
require_authorization
,
void
(
int64_t
,
int64_t
),
"require_auth2"
,
void
(
apply_context
::*
)(
const
account_name
&
,
const
permission_name
&
permission
))
...
...
@@ -1560,7 +1553,6 @@ REGISTER_INTRINSICS(apply_context,
(
is_account
,
int
(
int64_t
)
)
);
//(printdi, void(int64_t) )
REGISTER_INTRINSICS
(
console_api
,
(
prints
,
void
(
int
)
)
(
prints_l
,
void
(
int
,
int
)
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录