提交 fd75e48d 编写于 作者: B Brian Johnson

STAT-81 (GH-607) Fixes for rebase to upstream.

上级 9dfa4ede
......@@ -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*>(eosio::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);
eosio::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*>(eosio::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);
eosio::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*>(eosio::malloc(value_size));
store_str(N(dblimits), N(dblstr), key, sizeof(key), value, value_size);
eos::free(value);
eosio::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*>(eosio::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*>(eosio::realloc(value, value_size));
update_str(N(dblimits), N(dblstr), key, sizeof(key), value, value_size);
eos::free(value);
eosio::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*)eosio::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);
eosio::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*)eosio::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);
eosio::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*)eosio::malloc(value_size);
value[0] = 1024 * 2;
store_i64(N(dblimits), N(dbli64), (char*)value, value_size);
eos::free(value);
eosio::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*)eosio::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*)eosio::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);
eosio::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*)eosio::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);
eosio::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*)eosio::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*)eosio::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);
eosio::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*)eosio::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);
eosio::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*)eosio::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*)eosio::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);
eosio::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*)eosio::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);
eosio::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*)eosio::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*)eosio::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);
eosio::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*)eosio::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);
eosio::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*)eosio::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*)eosio::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);
eosio::free(value);
return WASM_TEST_PASS;
}
......@@ -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:
......
......@@ -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 {}); \
::eosio::chain_plugin::default_received_block_transaction_execution_time, \
::eosio::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); \
......
......@@ -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,
......
......@@ -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, ::eosio::chain_plugin::default_transaction_execution_time,
::eosio::chain_plugin::default_received_block_transaction_execution_time,
::eosio::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.
先完成此消息的编辑!
想要评论请 注册