Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
fd75e48d
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,发现更多精彩内容 >>
提交
fd75e48d
编写于
11月 16, 2017
作者:
B
Brian Johnson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
STAT-81 (GH-607) Fixes for rebase to upstream.
上级
9dfa4ede
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
47 deletion
+49
-47
contracts/test_api/test_db.cpp
contracts/test_api/test_db.cpp
+38
-38
libraries/chain/include/eos/chain/chain_controller.hpp
libraries/chain/include/eos/chain/chain_controller.hpp
+4
-4
tests/api_tests/api_tests.cpp
tests/api_tests/api_tests.cpp
+2
-2
tests/common/database_fixture.cpp
tests/common/database_fixture.cpp
+2
-0
tests/slow_tests/slow_tests.cpp
tests/slow_tests/slow_tests.cpp
+3
-3
未找到文件。
contracts/test_api/test_db.cpp
浏览文件 @
fd75e48d
...
...
@@ -1101,7 +1101,7 @@ unsigned int test_db::key_str_setup_limit()
// 1024 * 2 * (2528 + 32)
char
key
[]
=
"0000abcdefghijklmnopqrstuvwxy"
;
const
uint32_t
value_size
=
2498
;
char
*
value
=
static_cast
<
char
*>
(
eos
::
malloc
(
value_size
));
char
*
value
=
static_cast
<
char
*>
(
eos
io
::
malloc
(
value_size
));
value
[
4
]
=
'\0'
;
for
(
int
i
=
0
;
i
<
1024
*
2
;
++
i
)
{
...
...
@@ -1110,7 +1110,7 @@ unsigned int test_db::key_str_setup_limit()
set_key_str
(
i
,
value
);
store_str
(
N
(
dblimits
),
N
(
dblstr
),
key
,
sizeof
(
key
),
value
,
value_size
);
}
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1138,7 +1138,7 @@ unsigned int test_db::key_str_under_limit()
// 1024 * 2 * (2520 + 32) = 5,226,496 => 16K bytes remaining
char
key
[]
=
"0000abcdefghijklmnopqrstuvwxy"
;
const
uint32_t
value_size
=
2489
;
char
*
value
=
static_cast
<
char
*>
(
eos
::
malloc
(
value_size
));
char
*
value
=
static_cast
<
char
*>
(
eos
io
::
malloc
(
value_size
));
value
[
4
]
=
'\0'
;
for
(
int
i
=
0
;
i
<
1024
*
2
;
++
i
)
{
...
...
@@ -1147,7 +1147,7 @@ unsigned int test_db::key_str_under_limit()
set_key_str
(
i
,
value
);
store_str
(
N
(
dblimits
),
N
(
dblstr
),
key
,
sizeof
(
key
),
value
,
value_size
);
}
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1160,9 +1160,9 @@ unsigned int test_db::key_str_available_space_exceed_limit()
char
key
[]
=
"0000abcdefghijklmnopqrstuvwxy"
;
set_key_str
(
9999
,
key
);
const
uint32_t
value_size
=
16323
;
char
*
value
=
static_cast
<
char
*>
(
eos
::
malloc
(
value_size
));
char
*
value
=
static_cast
<
char
*>
(
eos
io
::
malloc
(
value_size
));
store_str
(
N
(
dblimits
),
N
(
dblstr
),
key
,
sizeof
(
key
),
value
,
value_size
);
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1176,7 +1176,7 @@ unsigned int test_db::key_str_another_under_limit()
char
key
[]
=
"0000abcdefghijklmnopqrstuvwxy"
;
set_key_str
(
0
,
key
);
uint32_t
value_size
=
18873
;
char
*
value
=
static_cast
<
char
*>
(
eos
::
malloc
(
value_size
));
char
*
value
=
static_cast
<
char
*>
(
eos
io
::
malloc
(
value_size
));
update_str
(
N
(
dblimits
),
N
(
dblstr
),
key
,
sizeof
(
key
),
value
,
value_size
);
// 0 bytes remaining
...
...
@@ -1193,9 +1193,9 @@ unsigned int test_db::key_str_another_under_limit()
// -> key + value bytes: 5040 Bytes
value_size
=
2489
+
2514
;
set_key_str
(
2
,
key
);
value
=
static_cast
<
char
*>
(
eos
::
realloc
(
value
,
value_size
));
value
=
static_cast
<
char
*>
(
eos
io
::
realloc
(
value
,
value_size
));
update_str
(
N
(
dblimits
),
N
(
dblstr
),
key
,
sizeof
(
key
),
value
,
value_size
);
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1209,13 +1209,13 @@ unsigned int test_db::key_i64_setup_limit()
// -> key + value bytes: 2528 Bytes
// 1024 * 2 * (2528 + 32) = 5,242,880
const
uint64_t
value_size
=
315
*
sizeof
(
uint64_t
)
+
1
;
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
for
(
int
i
=
0
;
i
<
1024
*
2
;
++
i
)
{
value
[
0
]
=
i
;
store_i64
(
N
(
dblimits
),
N
(
dbli64
),
(
char
*
)
value
,
value_size
);
}
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1236,14 +1236,14 @@ unsigned int test_db::key_i64_under_limit()
// -> key + value bytes: 2400 Bytes
// 1024 * 2 * (2400 + 32) = 4,980,736
const
uint64_t
value_size
=
300
*
sizeof
(
uint64_t
);
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
for
(
int
i
=
0
;
i
<
1024
*
2
;
++
i
)
{
value
[
0
]
=
i
;
store_i64
(
N
(
dblimits
),
N
(
dbli64
),
(
char
*
)
value
,
value_size
);
}
// 262,144 Bytes remaining
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1255,10 +1255,10 @@ unsigned int test_db::key_i64_available_space_exceed_limit()
// -> key + value bytes: 262,120 Bytes
// storing 262,152 Bytes exceeds remaining
const
uint64_t
value_size
=
32765
*
sizeof
(
uint64_t
);
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
value
[
0
]
=
1024
*
2
;
store_i64
(
N
(
dblimits
),
N
(
dbli64
),
(
char
*
)
value
,
value_size
);
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1270,7 +1270,7 @@ unsigned int test_db::key_i64_another_under_limit()
// -> key + value bytes: 264,544 Bytes
// replacing storage bytes so 264,544 - 2400 = 262,144 Bytes (0 Bytes remaining)
uint64_t
value_size
=
33067
*
sizeof
(
uint64_t
)
+
7
;
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
value
[
0
]
=
15
;
update_i64
(
N
(
dblimits
),
N
(
dbli64
),
(
char
*
)
value
,
value_size
);
...
...
@@ -1288,12 +1288,12 @@ unsigned int test_db::key_i64_another_under_limit()
// -> key + value bytes: 2,368 Bytes
// 2,400 Bytes allocated
value_size
=
295
*
sizeof
(
uint64_t
)
+
3
;
value
=
(
uint64_t
*
)
eos
::
realloc
(
value
,
value_size
);
value
=
(
uint64_t
*
)
eos
io
::
realloc
(
value
,
value_size
);
value
[
0
]
=
1024
*
2
;
store_i64
(
N
(
dblimits
),
N
(
dbli64
),
(
char
*
)
value
,
value_size
);
// 32 Bytes remaining (smallest row entry is 40 Bytes)
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1307,14 +1307,14 @@ unsigned int test_db::key_i128i128_setup_limit()
// -> key + value bytes: 2528 Bytes
// 1024 * 2 * (2528 + 32) = 5,242,880
const
uint64_t
value_size
=
315
*
sizeof
(
uint64_t
)
+
1
;
auto
value
=
(
uint128_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint128_t
*
)
eos
io
::
malloc
(
value_size
);
for
(
int
i
=
0
;
i
<
1024
*
2
;
++
i
)
{
value
[
0
]
=
i
;
value
[
1
]
=
value
[
0
]
+
1
;
store_i128i128
(
N
(
dblimits
),
N
(
dbli128i128
),
(
char
*
)
value
,
value_size
);
}
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1323,7 +1323,7 @@ unsigned int test_db::key_i128i128_min_exceed_limit()
// will allocate 32 + 32 Bytes
// at 5M Byte limit, so cannot store anything
const
uint64_t
value_size
=
2
*
sizeof
(
uint128_t
);
auto
value
=
(
uint128_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint128_t
*
)
eos
io
::
malloc
(
value_size
);
value
[
0
]
=
(
uint128_t
)
-
1
;
value
[
1
]
=
value
[
0
]
+
1
;
store_i128i128
(
N
(
dblimits
),
N
(
dbli128i128
),
(
char
*
)
&
value
,
value_size
);
...
...
@@ -1338,7 +1338,7 @@ unsigned int test_db::key_i128i128_under_limit()
// -> key + value bytes: 2400 Bytes
// 1024 * 2 * (2400 + 32) = 4,980,736
const
uint64_t
value_size
=
300
*
sizeof
(
uint64_t
);
auto
value
=
(
uint128_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint128_t
*
)
eos
io
::
malloc
(
value_size
);
for
(
int
i
=
0
;
i
<
1024
*
2
;
++
i
)
{
value
[
0
]
=
i
;
...
...
@@ -1346,7 +1346,7 @@ unsigned int test_db::key_i128i128_under_limit()
store_i128i128
(
N
(
dblimits
),
N
(
dbli128i128
),
(
char
*
)
value
,
value_size
);
}
// 262,144 Bytes remaining
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1358,11 +1358,11 @@ unsigned int test_db::key_i128i128_available_space_exceed_limit()
// -> key + value bytes: 262,120 Bytes
// storing 262,152 Bytes exceeds remaining
const
uint64_t
value_size
=
32765
*
sizeof
(
uint64_t
);
auto
value
=
(
uint128_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint128_t
*
)
eos
io
::
malloc
(
value_size
);
value
[
0
]
=
1024
*
2
;
value
[
1
]
=
value
[
0
]
+
1
;
store_i128i128
(
N
(
dblimits
),
N
(
dbli128i128
),
(
char
*
)
value
,
value_size
);
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1374,7 +1374,7 @@ unsigned int test_db::key_i128i128_another_under_limit()
// -> key + value bytes: 264,544 Bytes
// replacing storage bytes so 264,544 - 2400 = 262,144 Bytes (0 Bytes remaining)
uint64_t
value_size
=
33067
*
sizeof
(
uint64_t
)
+
7
;
auto
value
=
(
uint128_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint128_t
*
)
eos
io
::
malloc
(
value_size
);
value
[
0
]
=
15
;
value
[
1
]
=
value
[
0
]
+
1
;
update_i128i128
(
N
(
dblimits
),
N
(
dbli128i128
),
(
char
*
)
value
,
value_size
);
...
...
@@ -1394,13 +1394,13 @@ unsigned int test_db::key_i128i128_another_under_limit()
// -> key + value bytes: 2,344 Bytes
// 2,376 Bytes allocated
value_size
=
292
*
sizeof
(
uint64_t
)
+
3
;
value
=
(
uint128_t
*
)
eos
::
realloc
(
value
,
value_size
);
value
=
(
uint128_t
*
)
eos
io
::
realloc
(
value
,
value_size
);
value
[
0
]
=
1024
*
2
;
value
[
1
]
=
value
[
0
]
+
1
;
store_i128i128
(
N
(
dblimits
),
N
(
dbli128i128
),
(
char
*
)
value
,
value_size
);
// 56 Bytes remaining (smallest row entry is 64 Bytes)
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1414,7 +1414,7 @@ unsigned int test_db::key_i64i64i64_setup_limit()
// -> key + value bytes: 2528 Bytes
// 1024 * 2 * (2528 + 32) = 5,242,880
const
uint64_t
value_size
=
315
*
sizeof
(
uint64_t
)
+
1
;
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
for
(
int
i
=
0
;
i
<
1024
*
2
;
++
i
)
{
value
[
0
]
=
i
;
...
...
@@ -1422,7 +1422,7 @@ unsigned int test_db::key_i64i64i64_setup_limit()
value
[
2
]
=
value
[
0
]
+
2
;
store_i64i64i64
(
N
(
dblimits
),
N
(
dbli64i64i64
),
(
char
*
)
value
,
value_size
);
}
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1431,7 +1431,7 @@ unsigned int test_db::key_i64i64i64_min_exceed_limit()
// will allocate 24 + 32 Bytes
// at 5M Byte limit, so cannot store anything
const
uint64_t
value_size
=
3
*
sizeof
(
uint64_t
);
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
value
[
0
]
=
(
uint64_t
)
-
1
;
value
[
1
]
=
value
[
0
]
+
1
;
value
[
2
]
=
value
[
0
]
+
2
;
...
...
@@ -1447,7 +1447,7 @@ unsigned int test_db::key_i64i64i64_under_limit()
// -> key + value bytes: 2400 Bytes
// 1024 * 2 * (2400 + 32) = 4,980,736
const
uint64_t
value_size
=
300
*
sizeof
(
uint64_t
);
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
for
(
int
i
=
0
;
i
<
1024
*
2
;
++
i
)
{
value
[
0
]
=
i
;
...
...
@@ -1456,7 +1456,7 @@ unsigned int test_db::key_i64i64i64_under_limit()
store_i64i64i64
(
N
(
dblimits
),
N
(
dbli64i64i64
),
(
char
*
)
value
,
value_size
);
}
// 262,144 Bytes remaining
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1468,12 +1468,12 @@ unsigned int test_db::key_i64i64i64_available_space_exceed_limit()
// -> key + value bytes: 262,120 Bytes
// storing 262,152 Bytes exceeds remaining
const
uint64_t
value_size
=
32765
*
sizeof
(
uint64_t
);
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
value
[
0
]
=
1024
*
2
;
value
[
1
]
=
value
[
0
]
+
1
;
value
[
2
]
=
value
[
0
]
+
2
;
store_i64i64i64
(
N
(
dblimits
),
N
(
dbli64i64i64
),
(
char
*
)
value
,
value_size
);
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
...
...
@@ -1485,7 +1485,7 @@ unsigned int test_db::key_i64i64i64_another_under_limit()
// -> key + value bytes: 264,544 Bytes
// replacing storage bytes so 264,544 - 2400 = 262,144 Bytes (0 Bytes remaining)
uint64_t
value_size
=
33067
*
sizeof
(
uint64_t
)
+
7
;
auto
value
=
(
uint64_t
*
)
eos
::
malloc
(
value_size
);
auto
value
=
(
uint64_t
*
)
eos
io
::
malloc
(
value_size
);
value
[
0
]
=
15
;
value
[
1
]
=
value
[
0
]
+
1
;
value
[
2
]
=
value
[
0
]
+
2
;
...
...
@@ -1507,14 +1507,14 @@ unsigned int test_db::key_i64i64i64_another_under_limit()
// -> key + value bytes: 2,352 Bytes
// 2,384 Bytes allocated
value_size
=
295
*
sizeof
(
uint64_t
)
+
3
;
value
=
(
uint64_t
*
)
eos
::
realloc
(
value
,
value_size
);
value
=
(
uint64_t
*
)
eos
io
::
realloc
(
value
,
value_size
);
value
[
0
]
=
1024
*
2
;
value
[
1
]
=
value
[
0
]
+
1
;
value
[
2
]
=
value
[
0
]
+
2
;
store_i64i64i64
(
N
(
dblimits
),
N
(
dbli64i64i64
),
(
char
*
)
value
,
value_size
);
// 48 Bytes remaining (smallest row entry is 56 Bytes)
eos
::
free
(
value
);
eos
io
::
free
(
value
);
return
WASM_TEST_PASS
;
}
libraries/chain/include/eos/chain/chain_controller.hpp
浏览文件 @
fd75e48d
...
...
@@ -296,10 +296,10 @@ namespace eosio { namespace chain {
uint32_t
rate_limit
,
uint32_t
previous_rate
,
rate_limit_type
type
,
const
account_name
&
name
);
struct
txn_msg_limits
{
fc
::
time_point_sec
per_auth_account_txn_msg_rate_time_frame_sec
=
fc
::
time_point_sec
(
config
::
default_per_auth_account_time_frame_seconds
);
uint32_t
per_auth_account_txn_msg_rate
=
config
::
default_per_auth_account
;
fc
::
time_point_sec
per_code_account_txn_msg_rate_time_frame_sec
=
fc
::
time_point_sec
(
config
::
default_per_code_account_time_frame_seconds
);
uint32_t
per_code_account_txn_msg_rate
=
config
::
default_per_code_account
;
fc
::
time_point_sec
per_auth_account_txn_msg_rate_time_frame_sec
=
fc
::
time_point_sec
(
config
::
default_per_auth_account_
rate_
time_frame_seconds
);
uint32_t
per_auth_account_txn_msg_rate
=
config
::
default_per_auth_account
_rate
;
fc
::
time_point_sec
per_code_account_txn_msg_rate_time_frame_sec
=
fc
::
time_point_sec
(
config
::
default_per_code_account_
rate_
time_frame_seconds
);
uint32_t
per_code_account_txn_msg_rate
=
config
::
default_per_code_account
_rate
;
};
private:
...
...
tests/api_tests/api_tests.cpp
浏览文件 @
fd75e48d
...
...
@@ -655,8 +655,8 @@ TEST_CASE_TABLE_TYPE_FAILURE(test_table_load_fail_i64i64i64_with_str, ldiiinotst
auto wasm = assemble_wast( test_api_wast ); \
\
Make_Blockchain(chain, 500, \
::eos::chain_plugin::default_received_block_transaction_execution_time, \
::eos::chain_plugin::default_create_block_transaction_execution_time, chain_controller::txn_msg_limits {}); \
::eos
io
::chain_plugin::default_received_block_transaction_execution_time, \
::eos
io
::chain_plugin::default_create_block_transaction_execution_time, chain_controller::txn_msg_limits {}); \
chain.produce_blocks(2); \
Make_Account(chain, testapi); \
Make_Account(chain, dblimits); \
...
...
tests/common/database_fixture.cpp
浏览文件 @
fd75e48d
...
...
@@ -98,6 +98,8 @@ testing_blockchain::testing_blockchain(chainbase::database& db, fork_database& f
::
eosio
::
chain_plugin
::
default_received_block_transaction_execution_time
*
1000
,
::
eosio
::
chain_plugin
::
default_create_block_transaction_execution_time
*
1000
,
chain_controller
::
txn_msg_limits
{}),
db
(
db
),
fixture
(
fixture
)
{}
testing_blockchain
::
testing_blockchain
(
chainbase
::
database
&
db
,
fork_database
&
fork_db
,
block_log
&
blocklog
,
chain_initializer_interface
&
initializer
,
testing_fixture
&
fixture
,
...
...
tests/slow_tests/slow_tests.cpp
浏览文件 @
fd75e48d
...
...
@@ -315,9 +315,9 @@ void WithdrawCurrency( testing_blockchain& chain, account_name from, account_nam
BOOST_FIXTURE_TEST_CASE
(
create_script
,
testing_fixture
)
{
try
{
chain_controller
::
txn_msg_limits
rate_limit
=
{
fc
::
time_point_sec
(
10
),
100000
,
fc
::
time_point_sec
(
10
),
100000
};
Make_Blockchain
(
chain
,
::
eos
::
chain_plugin
::
default_transaction_execution_time
,
::
eos
::
chain_plugin
::
default_received_block_transaction_execution_time
,
::
eos
::
chain_plugin
::
default_create_block_transaction_execution_time
,
rate_limit
);
Make_Blockchain
(
chain
,
::
eos
io
::
chain_plugin
::
default_transaction_execution_time
,
::
eos
io
::
chain_plugin
::
default_received_block_transaction_execution_time
,
::
eos
io
::
chain_plugin
::
default_create_block_transaction_execution_time
,
rate_limit
);
chain
.
produce_blocks
(
10
);
Make_Account
(
chain
,
currency
);
chain
.
produce_blocks
(
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录