Skip to content

Commit

Permalink
GH-1251 Address peer review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jun 22, 2023
1 parent 8706738 commit 98e3b81
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/01_nodeos/03_plugins/chain_plugin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ Config Options for eosio::chain_plugin:
--eos-vm-oc-enable arg (=auto) Enable EOS VM OC tier-up runtime
('auto', 'all', 'none').
'auto' - EOS VM OC tier-up is enabled
for eosio.* accounts and read-only
trxs.
for eosio.* accounts, read-only trxs,
and applying blocks.
'all' - EOS VM OC tier-up is enabled
for all contract execution.
'none' - EOS VM OC tier-up is
Expand Down
6 changes: 3 additions & 3 deletions libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,9 @@ action_name apply_context::get_sender() const {
// Compute trx | baseline, OC for eosio.*
// Read only trx | OC
bool apply_context::should_use_eos_vm_oc()const {
return trx_context.is_read_only()
|| receiver.prefix() == config::system_account_name // "eosio"_n, all cases use OC
|| (trx_context.explicit_billed_cpu_time && !control.is_producer_node()); // validating/applying block
return receiver.prefix() == config::system_account_name // "eosio"_n, all cases use OC
|| (trx_context.explicit_billed_cpu_time && !control.is_producer_node()) // validating/applying block
|| trx_context.is_read_only();
}


Expand Down
6 changes: 3 additions & 3 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ struct controller_impl {
controller::config conf;
const chain_id_type chain_id; // read by thread_pool threads, value will not be changed
bool replaying = false;
bool producer_node = false; // true if node is configured as a block producer
bool is_producer_node = false; // true if node is configured as a block producer
db_read_mode read_mode = db_read_mode::HEAD;
bool in_trx_requiring_checks = false; ///< if true, checks that are normally skipped on replay (e.g. auth checks) cannot be skipped
std::optional<fc::microseconds> subjective_cpu_leeway;
Expand Down Expand Up @@ -3679,11 +3679,11 @@ void controller::replace_account_keys( name account, name permission, const publ
}

void controller::set_producer_node(bool is_producer_node) {
my->producer_node = is_producer_node;
my->is_producer_node = is_producer_node;
}

bool controller::is_producer_node()const {
return my->producer_node;
return my->is_producer_node;
}

void controller::set_db_read_only_mode() {
Expand Down
2 changes: 1 addition & 1 deletion plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ void chain_plugin::set_program_options(options_description& cli, options_descrip
}), "Number of threads to use for EOS VM OC tier-up")
("eos-vm-oc-enable", bpo::value<chain::wasm_interface::vm_oc_enable>()->default_value(chain::wasm_interface::vm_oc_enable::oc_auto),
"Enable EOS VM OC tier-up runtime ('auto', 'all', 'none').\n"
"'auto' - EOS VM OC tier-up is enabled for eosio.* accounts and read-only trxs.\n"
"'auto' - EOS VM OC tier-up is enabled for eosio.* accounts, read-only trxs, and applying blocks.\n"
"'all' - EOS VM OC tier-up is enabled for all contract execution.\n"
"'none' - EOS VM OC tier-up is completely disabled.\n")
#endif
Expand Down
2 changes: 2 additions & 0 deletions unittests/misc_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,14 @@ BOOST_AUTO_TEST_CASE(name_prefix_tests)
BOOST_CHECK_EQUAL("abcdefghijkl"_n.prefix(), "abcdefghijkl"_n);
BOOST_CHECK_EQUAL("abc.xyz"_n.prefix(), "abc"_n);
BOOST_CHECK_EQUAL("abc.xyz.qrt"_n.prefix(), "abc.xyz"_n);
BOOST_CHECK_EQUAL("."_n.prefix(), ""_n);

BOOST_CHECK_EQUAL("eosio.any"_n.prefix(), "eosio"_n);
BOOST_CHECK_EQUAL("eosio"_n.prefix(), "eosio"_n);
BOOST_CHECK_EQUAL("eosio"_n.prefix(), config::system_account_name);
BOOST_CHECK_EQUAL("eosio."_n.prefix(), "eosio"_n);
BOOST_CHECK_EQUAL("eosio.evm"_n.prefix(), "eosio"_n);
BOOST_CHECK_EQUAL(".eosio"_n.prefix(), ""_n);
BOOST_CHECK_NE("eosi"_n.prefix(), "eosio"_n);
BOOST_CHECK_NE("eosioeosio"_n.prefix(), "eosio"_n);
BOOST_CHECK_NE("eosioe"_n.prefix(), "eosio"_n);
Expand Down

0 comments on commit 98e3b81

Please sign in to comment.