Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/5.0' into gh_1764_main
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Oct 26, 2023
2 parents 9fe0a72 + 200bfa9 commit 7b698a4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 42 deletions.
2 changes: 0 additions & 2 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,6 @@ struct controller_impl {
ilog( "Snapshot loaded, lib: ${lib}", ("lib", head->block_num) );

init(std::move(check_shutdown));
if (conf.revert_to_private_mode)
db.revert_to_private_mode();
auto snapshot_load_time = (fc::time_point::now() - snapshot_load_start_time).to_seconds();
ilog( "Finished initialization from snapshot (snapshot load time was ${t}s)", ("t", snapshot_load_time) );
} catch (boost::interprocess::bad_alloc& e) {
Expand Down
1 change: 0 additions & 1 deletion libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ namespace eosio { namespace chain {
bool disable_replay_opts = false;
bool contracts_console = false;
bool allow_ram_billing_in_notify = false;
bool revert_to_private_mode = false;
uint32_t maximum_variable_signature_length = chain::config::default_max_variable_signature_length;
bool disable_all_subjective_mitigations = false; //< for developer & testing purposes, can be configured using `disable-all-subjective-mitigations` when `EOSIO_DEVELOPER` build option is provided
uint32_t terminate_at_block = 0;
Expand Down
7 changes: 0 additions & 7 deletions plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,13 +927,6 @@ void chain_plugin_impl::plugin_initialize(const variables_map& options) {

chain_config->db_map_mode = options.at("database-map-mode").as<pinnable_mapped_file::map_mode>();

// when loading a snapshot, all the state will be modified, so temporarily use the `mapped` mode instead
// of `mapped_private` to lower memory requirements.
if (snapshot_path && chain_config->db_map_mode == pinnable_mapped_file::mapped_private) {
chain_config->db_map_mode = pinnable_mapped_file::mapped;
chain_config->revert_to_private_mode = true; // revert to `mapped_private` mode after loading snapshot.
}

#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
if( options.count("eos-vm-oc-cache-size-mb") )
chain_config->eosvmoc_config.cache_size = options.at( "eos-vm-oc-cache-size-mb" ).as<uint64_t>() * 1024u * 1024u;
Expand Down
48 changes: 17 additions & 31 deletions tests/test_read_only_trx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,16 @@ void test_trxs_common(std::vector<const char*>& specific_args, bool test_disable
std::thread app_thread( [&]() {
try {
fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::debug);
std::vector<const char*> argv = {"test", "--data-dir", temp_dir_str.c_str(), "--config-dir", temp_dir_str.c_str()};
std::vector<const char*> argv = {
"test", // dummy executible name
"-p", "eosio", "-e", // actual arguments follow
"--data-dir", temp_dir_str.c_str(),
"--config-dir", temp_dir_str.c_str(),
"--max-transaction-time=100",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=100000",
"--read-only-read-window-time-us=400000"
};
argv.insert(argv.end(), specific_args.begin(), specific_args.end());
app->initialize<chain_plugin, producer_plugin>(argv.size(), (char**)&argv[0]);
app->find_plugin<chain_plugin>()->chain();
Expand Down Expand Up @@ -179,62 +188,39 @@ void test_trxs_common(std::vector<const char*>& specific_args, bool test_disable

// test read-only trxs on 1 threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_1_read_only_threads) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=1",
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=100000",
"--read-only-read-window-time-us=40000" };
std::vector<const char*> specific_args = { "--read-only-threads=1" };
test_trxs_common(specific_args);
}

// test read-only trxs on 3 threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_3_read_only_threads) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=3",
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=100000",
"--read-only-read-window-time-us=40000" };
std::vector<const char*> specific_args = { "--read-only-threads=3" };
test_trxs_common(specific_args);
}

// test read-only trxs on 3 threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_3_read_only_threads_no_tierup) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=3",
std::vector<const char*> specific_args = { "--read-only-threads=3",
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
"--eos-vm-oc-enable=none",
#endif
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=100000",
"--read-only-read-window-time-us=40000" };
};
test_trxs_common(specific_args, true);
}

// test read-only trxs on 8 separate threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_8_read_only_threads) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=8",
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=10000",
"--read-only-read-window-time-us=400000" };
std::vector<const char*> specific_args = { "--read-only-threads=8" };
test_trxs_common(specific_args);
}

// test read-only trxs on 8 separate threads (with --read-only-threads)
BOOST_AUTO_TEST_CASE(with_8_read_only_threads_no_tierup) {
std::vector<const char*> specific_args = { "-p", "eosio", "-e",
"--read-only-threads=8",
std::vector<const char*> specific_args = { "--read-only-threads=8",
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
"--eos-vm-oc-enable=none",
#endif
"--max-transaction-time=10",
"--abi-serializer-max-time-ms=999",
"--read-only-write-window-time-us=10000",
"--read-only-read-window-time-us=400000" };
};
test_trxs_common(specific_args, true);
}

Expand Down

0 comments on commit 7b698a4

Please sign in to comment.