-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix get_table_rows_by_seckey conversion #9605
Conversation
can you explain why get_table_rows_by_seckey was working incorrectly if you used string representation of name instead of string representaton of underlying integer? |
convert_to_type calls boost::lexical_cast<uint64_t>( str.c_str()) The return value is: template<> |
@kimjh2005 that is understood. I don't get why |
the return value 1111 is not correct value for eosio::name for "1111"_n. It should have uint64_t number which is not 1111. |
@kimjh2005 eosio::chain::name "1111"_n is valid name. However I looked in the code and I understood why it fails. I'll propose some alternative solution inline in comments. |
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
Outdated
Show resolved
Hide resolved
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
Outdated
Show resolved
Hide resolved
SecKeyType lv = convert_to_type<SecKeyType>( s.to_string(), "lower_bound name" ); // avoids compiler error | ||
std::get<1>(lower_bound_lookup_tuple) = conv( lv ); | ||
if constexpr (std::is_same_v<uint64_t, SecKeyType>) { | ||
SecKeyType lv = convert_to_type(s, "lower_bound 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.
I don't think you need L-value here. This should work as long as reference is const:
SecKeyType lv = convert_to_type({p.lower_bound}, "lower_bound name");
Change Description
fixed function get_table_rows_by_seckey converts lower and upper value in eosio::name incorrectly.
Change Type
Select ONE
Consensus Changes
API Changes
Documentation Additions