-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Refactor max_serialization_time to be passed as argument instead #4463
Conversation
andriantolie
commented
Jul 3, 2018
•
edited by heifner
Loading
edited by heifner
- max_serialization_time is moved from the static variable abi_serializer::max_serialization_time to being passed into methods that require it
- Pass max_serialization_time as arguments instead of static variable of abi_serializer
@@ -58,6 +58,7 @@ namespace eosio { namespace chain { | |||
|
|||
genesis_state genesis; | |||
wasm_interface::vm_type wasm_runtime = chain::config::default_wasm_runtime; | |||
fc::microseconds abi_serializer_max_time_ms = chain::config::default_abi_serializer_max_time_ms; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't store this on controller as it is only slightly better than storing on abi_serializer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on moving setting out of controller.
Needs reviewed by someone else, I've made extensive changes.
@@ -252,7 +252,8 @@ namespace { | |||
abi = chain::eosio_contract_abi(abi); | |||
} | |||
abis.set_abi(abi); | |||
auto v = abis.binary_to_variant(abis.get_action_type(msg.name), msg.data); | |||
chain_plugin* chain_plug = app().find_plugin<chain_plugin>(); | |||
auto v = abis.binary_to_variant(abis.get_action_type(msg.name), msg.data, chain_plug.chain().get_abi_serializer_max_time_ms()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_abi_serializer_max_time_ms of chain_controller is already removed
@@ -638,7 +639,8 @@ void mongo_db_plugin_impl::update_account(const chain::action& msg) { | |||
auto eosio_account = find_account(accounts, msg.account); | |||
auto abi = fc::json::from_string(bsoncxx::to_json(eosio_account.view()["abi"].get_document())).as<abi_def>(); | |||
abis.set_abi(abi); | |||
auto transfer = abis.binary_to_variant(abis.get_action_type(msg.name), msg.data); | |||
chain_plugin* chain_plug = app().find_plugin<chain_plugin>(); | |||
auto transfer = abis.binary_to_variant(abis.get_action_type(msg.name), msg.data, chain_plug.chain().get_abi_serializer_max_time_ms()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_abi_serializer_max_time_ms of chain_controller is already removed
@@ -443,7 +443,7 @@ fc::variant account_history_plugin_impl::transaction_to_variant(const packed_tra | |||
}; | |||
|
|||
fc::variant pretty_output; | |||
abi_serializer::to_variant(ptrx, pretty_output, resolver); | |||
abi_serializer::to_variant(ptrx, pretty_output, resolver, chain_plug->chain().get_abi_serializer_max_time_ms()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_abi_serializer_max_time_ms of chain_controller is already removed. But I guess, we won't need to use account_history_plugin anymore since we have history_plugin now.
unittests/eosio_system_tester.hpp
Outdated
@@ -437,7 +437,7 @@ class eosio_system_tester : public TESTER { | |||
action act; | |||
act.account = N(eosio.msig); | |||
act.name = name; | |||
act.data = msig_abi_ser.variant_to_binary( action_type_name, data ); | |||
act.data = msig_abi_ser.variant_to_binary( action_type_name, data, control->get_abi_serializer_max_time_ms() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_abi_serializer_max_time_ms of chain_controller is already removed (this piece of code is actually just inside a comment)
unittests/multisig_tests.cpp
Outdated
@@ -151,19 +151,19 @@ class eosio_msig_tester : public tester { | |||
action act; | |||
act.account = N(eosio.msig); | |||
act.name = name; | |||
act.data = abi_ser.variant_to_binary( action_type_name, data ); | |||
act.data = abi_ser.variant_to_binary( action_type_name, data, control->get_abi_serializer_max_time_ms() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_abi_serializer_max_time_ms of chain_controller is already removed (this piece of code is actually just inside a comment)
libraries/chain/abi_serializer.cpp
Outdated
@@ -193,7 +193,7 @@ namespace eosio { namespace chain { | |||
return itr->second; | |||
} | |||
|
|||
void abi_serializer::validate()const { | |||
void abi_serializer::validate(const fc::microseconds& max_serialization_time)const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Called by set_abi()
but calculates its own deadline. Should instead accept a deadline.
libraries/chain/abi_serializer.cpp
Outdated
@@ -348,16 +348,16 @@ namespace eosio { namespace chain { | |||
|
|||
FC_ASSERT( st.base == type_name(), "support for base class as array not yet implemented" ); | |||
/*if( st.base != type_name() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code.
libraries/testing/tester.cpp
Outdated
@@ -427,7 +426,7 @@ namespace eosio { namespace testing { | |||
const variant_object& data )const { try { | |||
const auto& acnt = control->get_account(code); | |||
auto abi = acnt.get_abi(); | |||
chain::abi_serializer abis(abi); | |||
chain::abi_serializer abis(abi, abi_serializer_max_time); | |||
// auto a = control->get_account(code).get_abi(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code.
@@ -1185,7 +1193,7 @@ read_only::get_account_results read_only::get_account( const get_account_params& | |||
//const abi_def abi = get_abi( db, N(eosio) ); | |||
abi_def abi; | |||
if( abi_serializer::to_abi(code_account.abi, abi) ) { | |||
abi_serializer abis( abi ); | |||
abi_serializer abis( abi, abi_serializer_max_time ); | |||
//get_table_rows_ex<key_value_index, by_scope_primary>(p,abi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code.
@@ -1,4 +1,5 @@ | |||
file(GLOB HEADERS "include/eosio/history_plugin/*.hpp") | |||
file(GLOB HEADERS "include/eosio/history_plugin/*.hpp" | |||
"include/eosio/*.hpp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every eosio/ header always? Seems a bit of a blunt instrument...
PR Updated based on @jgiszczak comments (pass the deadline to validate() and remove commented code). For @jgiszczak comment regarding eosio/* header inclusion in history_plugin CMakeList.txt, can @heifner please respond to it? Thanks! |
…o_variant_with_abi.
… serializer deadline.