Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Refactor max_serialization_time to be passed as argument instead #4463

Merged
merged 16 commits into from
Jul 9, 2018

Conversation

andriantolie
Copy link
Contributor

@andriantolie andriantolie commented Jul 3, 2018

  • 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

@andriantolie andriantolie requested a review from heifner July 3, 2018 07:12
@andriantolie andriantolie added this to the Version 1.1 milestone Jul 3, 2018
@heifner heifner self-assigned this Jul 5, 2018
@@ -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;
Copy link
Contributor

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.

heifner
heifner previously requested changes Jul 5, 2018
Copy link
Contributor

@heifner heifner left a 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.

@heifner heifner dismissed their stale review July 5, 2018 21:19

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());
Copy link
Contributor Author

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());
Copy link
Contributor Author

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());
Copy link
Contributor Author

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.

@@ -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() );
Copy link
Contributor Author

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)

@@ -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() );
Copy link
Contributor Author

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)

@@ -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 {
Copy link
Contributor

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.

@@ -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() ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented code.

@@ -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();
Copy link
Contributor

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);
Copy link
Contributor

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")
Copy link
Contributor

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...

@andriantolie
Copy link
Contributor Author

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!

@heifner heifner merged commit 51c8cda into release/1.1 Jul 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants