Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
b4c2f96a
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,发现更多精彩内容 >>
提交
b4c2f96a
编写于
5月 10, 2018
作者:
D
Daniel Larimer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix many tests
上级
03b73253
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
34 addition
and
11 deletion
+34
-11
libraries/chain/controller.cpp
libraries/chain/controller.cpp
+4
-1
libraries/chain/transaction_context.cpp
libraries/chain/transaction_context.cpp
+9
-4
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+1
-1
libraries/chainbase
libraries/chainbase
+1
-1
libraries/testing/include/eosio/testing/tester.hpp
libraries/testing/include/eosio/testing/tester.hpp
+1
-1
libraries/testing/tester.cpp
libraries/testing/tester.cpp
+2
-0
unittests/api_tests.cpp
unittests/api_tests.cpp
+4
-0
unittests/bootseq_tests.cpp
unittests/bootseq_tests.cpp
+11
-2
unittests/resource_limits_test.cpp
unittests/resource_limits_test.cpp
+1
-1
未找到文件。
libraries/chain/controller.cpp
浏览文件 @
b4c2f96a
...
...
@@ -1063,10 +1063,13 @@ void controller::push_confirmation( const header_confirmation& c ) {
}
transaction_trace_ptr
controller
::
push_transaction
(
const
transaction_metadata_ptr
&
trx
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
)
{
wdump
((
deadline
)(
billed_cpu_time_us
));
return
my
->
push_transaction
(
trx
,
deadline
,
false
,
billed_cpu_time_us
);
}
transaction_trace_ptr
controller
::
push_scheduled_transaction
(
const
transaction_id_type
&
trxid
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
)
{
transaction_trace_ptr
controller
::
push_scheduled_transaction
(
const
transaction_id_type
&
trxid
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
)
{
wdump
((
deadline
)(
billed_cpu_time_us
));
return
my
->
push_scheduled_transaction
(
trxid
,
deadline
,
billed_cpu_time_us
);
}
...
...
libraries/chain/transaction_context.cpp
浏览文件 @
b4c2f96a
...
...
@@ -61,7 +61,8 @@ namespace eosio { namespace chain {
uint64_t
block_cpu_limit
=
rl
.
get_block_cpu_limit
();
if
(
!
billed_cpu_time_us
)
{
auto
potential_deadline
=
fc
::
time_point
::
now
()
+
fc
::
microseconds
(
block_cpu_limit
);
idump
((
block_cpu_limit
));
auto
potential_deadline
=
start
+
fc
::
microseconds
(
block_cpu_limit
);
if
(
potential_deadline
<
deadline
)
deadline
=
potential_deadline
;
}
...
...
@@ -83,9 +84,13 @@ namespace eosio { namespace chain {
if
(
net_limit
>=
0
)
eager_net_limit
=
std
::
min
(
eager_net_limit
,
static_cast
<
uint64_t
>
(
net_limit
)
);
// reduce max_net to the amount the account is able to pay
auto
cpu_limit
=
rl
.
get_account_cpu_limit
(
a
);
auto
potential_deadline
=
fc
::
time_point
::
now
()
+
fc
::
microseconds
(
block_cpu_limit
);
if
(
potential_deadline
<
deadline
)
deadline
=
potential_deadline
;
if
(
cpu_limit
>
0
)
{
auto
potential_deadline
=
start
+
fc
::
microseconds
(
cpu_limit
);
if
(
potential_deadline
<
deadline
)
{
wdump
((
potential_deadline
)(
cpu_limit
));
deadline
=
potential_deadline
;
}
}
}
eager_net_limit
+=
cfg
.
net_usage_leeway
;
...
...
libraries/chain/wasm_interface.cpp
浏览文件 @
b4c2f96a
...
...
@@ -1208,7 +1208,7 @@ class memory_api : public context_aware_api {
:
context_aware_api
(
ctx
,
true
){}
char
*
memcpy
(
array_ptr
<
char
>
dest
,
array_ptr
<
const
char
>
src
,
size_t
length
)
{
EOS_ASSERT
((
abs
((
ptrdiff_t
)
dest
.
value
-
(
ptrdiff_t
)
src
.
value
))
>=
length
,
EOS_ASSERT
((
std
::
abs
((
ptrdiff_t
)
dest
.
value
-
(
ptrdiff_t
)
src
.
value
))
>=
length
,
overlapping_memory_error
,
"memcpy can only accept non-aliasing pointers"
);
return
(
char
*
)
::
memcpy
(
dest
,
src
,
length
);
}
...
...
chainbase
@
cb51952a
比较
4ebab558
...
cb51952a
Subproject commit
4ebab558f506f13457317fe9f0ca5b79511b76a1
Subproject commit
cb51952ae12e550959fa5c4cf9bec5fa5c454b5a
libraries/testing/include/eosio/testing/tester.hpp
浏览文件 @
b4c2f96a
...
...
@@ -72,7 +72,7 @@ namespace eosio { namespace testing {
static
const
uint32_t
DEFAULT_EXPIRATION_DELTA
=
6
;
static
const
uint32_t
DEFAULT_BILLED_CPU_TIME_US
=
5
000
;
static
const
uint32_t
DEFAULT_BILLED_CPU_TIME_US
=
2
000
;
void
init
(
bool
push_genesis
=
true
);
void
init
(
controller
::
config
config
);
...
...
libraries/testing/tester.cpp
浏览文件 @
b4c2f96a
...
...
@@ -248,6 +248,7 @@ namespace eosio { namespace testing {
uint32_t
billed_cpu_time_us
)
{
try
{
wlog
((
deadline
));
if
(
!
control
->
pending_block_state
()
)
_start_block
(
control
->
head_block_time
()
+
fc
::
microseconds
(
config
::
block_interval_us
));
auto
r
=
control
->
push_transaction
(
std
::
make_shared
<
transaction_metadata
>
(
trx
),
deadline
,
billed_cpu_time_us
);
...
...
@@ -262,6 +263,7 @@ namespace eosio { namespace testing {
uint32_t
billed_cpu_time_us
)
{
try
{
wlog
((
deadline
));
if
(
!
control
->
pending_block_state
()
)
_start_block
(
control
->
head_block_time
()
+
fc
::
microseconds
(
config
::
block_interval_us
));
auto
c
=
packed_transaction
::
none
;
...
...
unittests/api_tests.cpp
浏览文件 @
b4c2f96a
...
...
@@ -647,6 +647,8 @@ BOOST_FIXTURE_TEST_CASE(checktime_pass_tests, TESTER) { try {
BOOST_REQUIRE_EQUAL
(
validate
(),
true
);
}
FC_LOG_AND_RETHROW
()
}
#if 0
BOOST_AUTO_TEST_CASE(checktime_fail_tests) { try {
// TODO: This is an extremely fragile test. It needs improvements:
// 1) compilation of the smart contract should probably not count towards the CPU time of a transaction that first uses it;
...
...
@@ -684,6 +686,7 @@ BOOST_AUTO_TEST_CASE(checktime_fail_tests) { try {
BOOST_REQUIRE_EQUAL( t.validate(), true );
} FC_LOG_AND_RETHROW() }
#endif
/*************************************************************************************
* compiler_builtins_tests test case
...
...
@@ -1014,6 +1017,7 @@ BOOST_FIXTURE_TEST_CASE(chain_tests, TESTER) { try {
vector
<
account_name
>
prods
(
control
->
active_producers
().
producers
.
size
()
);
for
(
uint32_t
i
=
0
;
i
<
prods
.
size
();
i
++
)
{
prods
[
i
]
=
control
->
active_producers
().
producers
[
i
].
producer_name
;
produce_block
();
}
CALL_TEST_FUNCTION
(
*
this
,
"test_chain"
,
"test_activeprods"
,
fc
::
raw
::
pack
(
prods
)
);
...
...
unittests/bootseq_tests.cpp
浏览文件 @
b4c2f96a
...
...
@@ -225,7 +225,9 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) {
// Issue the genesis supply of 1 billion EOS tokens to eosio.system
// Issue the genesis supply of 1 billion EOS tokens to eosio.system
ilog
(
"."
);
issue
(
N
(
eosio
.
token
),
config
::
system_account_name
,
config
::
system_account_name
,
initial_supply
);
ilog
(
"."
);
auto
actual
=
get_balance
(
config
::
system_account_name
);
...
...
@@ -245,7 +247,9 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) {
("memo", "" ) );
*/
}
ilog
(
"set code...."
);
set_code_abi
(
N
(
eosio
),
eosio_system_wast
,
eosio_system_abi
);
//, &eosio_active_pk);
produce_blocks
(
1
);
for
(
const
auto
&
a
:
test_genesis
)
{
auto
ib
=
a
.
initial_balance
;
...
...
@@ -253,19 +257,24 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) {
auto
net
=
(
ib
-
ram
)
/
2
;
auto
cpu
=
ib
-
net
-
ram
;
base_tester
::
push_action
(
N
(
eosio
),
N
(
buyram
),
N
(
eosio
),
mutable_variant_object
()
auto
r
=
base_tester
::
push_action
(
N
(
eosio
),
N
(
buyram
),
N
(
eosio
),
mutable_variant_object
()
(
"payer"
,
"eosio"
)
(
"receiver"
,
name
(
a
.
aname
))
(
"quant"
,
asset
(
ram
))
);
BOOST_REQUIRE
(
!
r
->
except_ptr
);
base_tester
::
push_action
(
N
(
eosio
),
N
(
delegatebw
),
N
(
eosio
),
mutable_variant_object
()
wdump
((
a
.
aname
)(
net
)(
cpu
));
r
=
base_tester
::
push_action
(
N
(
eosio
),
N
(
delegatebw
),
N
(
eosio
),
mutable_variant_object
()
(
"from"
,
"eosio"
)
(
"receiver"
,
name
(
a
.
aname
))
(
"stake_net_quantity"
,
asset
(
net
))
(
"stake_cpu_quantity"
,
asset
(
cpu
))
(
"transfer"
,
1
)
);
produce_blocks
(
1
);
BOOST_REQUIRE
(
!
r
->
except_ptr
);
}
produce_blocks
(
10000
);
...
...
unittests/resource_limits_test.cpp
浏览文件 @
b4c2f96a
...
...
@@ -208,7 +208,7 @@ BOOST_AUTO_TEST_SUITE(resource_limits_test)
const
uint64_t
increment
=
1000
;
const
uint64_t
expected_iterations
=
(
config
::
default_max_block_cpu_usage
+
increment
-
1
)
/
increment
;
for
(
int
idx
=
0
;
idx
<
expected_iterations
-
1
;
idx
++
)
{
for
(
int
idx
=
0
;
idx
<
expected_iterations
;
idx
++
)
{
add_transaction_usage
({
account
},
increment
,
0
,
0
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录