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

Commit

Permalink
Merge pull request #9385 from EOSIO/epe112
Browse files Browse the repository at this point in the history
Remove deprecated functions in abi_serializer for EPE112
  • Loading branch information
softprofe authored Aug 17, 2020
2 parents 78b8f93 + 7c0e55e commit 34d7bd9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
29 changes: 0 additions & 29 deletions libraries/chain/abi_serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ namespace eosio { namespace chain {
set_abi(abi, yield);
}

abi_serializer::abi_serializer( const abi_def& abi, const fc::microseconds& max_serialization_time) {
configure_built_in_types();
set_abi(abi, max_serialization_time);
}

void abi_serializer::add_specialized_unpack_pack( const string& name,
std::pair<abi_serializer::unpack_function, abi_serializer::pack_function> unpack_pack ) {
built_in_types[name] = std::move( unpack_pack );
Expand Down Expand Up @@ -182,10 +177,6 @@ namespace eosio { namespace chain {
validate(ctx);
}

void abi_serializer::set_abi(const abi_def& abi, const fc::microseconds& max_serialization_time) {
return set_abi(abi, create_yield_function(max_serialization_time));
}

bool abi_serializer::is_builtin_type(const std::string_view& type)const {
return built_in_types.find(type) != built_in_types.end();
}
Expand Down Expand Up @@ -220,10 +211,6 @@ namespace eosio { namespace chain {
return _is_type(type, ctx);
}

bool abi_serializer::is_type(const std::string_view& type, const fc::microseconds& max_serialization_time) const {
return is_type(type, create_yield_function(max_serialization_time));
}

std::string_view abi_serializer::fundamental_type(const std::string_view& type)const {
if( is_array(type) ) {
return type.substr(0, type.size()-2);
Expand Down Expand Up @@ -436,20 +423,12 @@ namespace eosio { namespace chain {
return _binary_to_variant(type, binary, ctx);
}

fc::variant abi_serializer::binary_to_variant( const std::string_view& type, const bytes& binary, const fc::microseconds& max_serialization_time, bool short_path )const {
return binary_to_variant( type, binary, create_yield_function(max_serialization_time), short_path );
}

fc::variant abi_serializer::binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const yield_function_t& yield, bool short_path )const {
impl::binary_to_variant_context ctx(*this, yield, type);
ctx.short_path = short_path;
return _binary_to_variant(type, binary, ctx);
}

fc::variant abi_serializer::binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const fc::microseconds& max_serialization_time, bool short_path )const {
return binary_to_variant( type, binary, create_yield_function(max_serialization_time), short_path );
}

void abi_serializer::_variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char *>& ds, impl::variant_to_binary_context& ctx )const
{ try {
auto h = ctx.enter_scope();
Expand Down Expand Up @@ -575,20 +554,12 @@ namespace eosio { namespace chain {
return _variant_to_binary(type, var, ctx);
}

bytes abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, const fc::microseconds& max_serialization_time, bool short_path ) const {
return variant_to_binary( type, var, create_yield_function(max_serialization_time), short_path );
}

void abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const yield_function_t& yield, bool short_path )const {
impl::variant_to_binary_context ctx(*this, yield, type);
ctx.short_path = short_path;
_variant_to_binary(type, var, ds, ctx);
}

void abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const fc::microseconds& max_serialization_time, bool short_path ) const {
variant_to_binary( type, var, create_yield_function(max_serialization_time), short_path );
}

type_name abi_serializer::get_action_type(name action)const {
auto itr = actions.find(action);
if( itr != actions.end() ) return itr->second;
Expand Down
29 changes: 0 additions & 29 deletions libraries/chain/include/eosio/chain/abi_serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,13 @@ struct abi_serializer {

abi_serializer(){ configure_built_in_types(); }
abi_serializer( const abi_def& abi, const yield_function_t& yield );
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
abi_serializer( const abi_def& abi, const fc::microseconds& max_serialization_time );
void set_abi( const abi_def& abi, const yield_function_t& yield );
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
void set_abi(const abi_def& abi, const fc::microseconds& max_serialization_time);

/// @return string_view of `t` or internal string type
std::string_view resolve_type(const std::string_view& t)const;
bool is_array(const std::string_view& type)const;
bool is_optional(const std::string_view& type)const;
bool is_type( const std::string_view& type, const yield_function_t& yield )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
bool is_type(const std::string_view& type, const fc::microseconds& max_serialization_time)const;
bool is_builtin_type(const std::string_view& type)const;
bool is_integer(const std::string_view& type) const;
int get_integer_size(const std::string_view& type) const;
Expand All @@ -65,30 +59,16 @@ struct abi_serializer {
optional<string> get_error_message( uint64_t error_code )const;

fc::variant binary_to_variant( const std::string_view& type, const bytes& binary, const yield_function_t& yield, bool short_path = false )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
fc::variant binary_to_variant( const std::string_view& type, const bytes& binary, const fc::microseconds& max_serialization_time, bool short_path = false )const;
fc::variant binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const yield_function_t& yield, bool short_path = false )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
fc::variant binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const fc::microseconds& max_serialization_time, bool short_path = false )const;

[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
bytes variant_to_binary( const std::string_view& type, const fc::variant& var, const fc::microseconds& max_serialization_time, bool short_path = false )const;
bytes variant_to_binary( const std::string_view& type, const fc::variant& var, const yield_function_t& yield, bool short_path = false )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
void variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const fc::microseconds& max_serialization_time, bool short_path = false )const;
void variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const yield_function_t& yield, bool short_path = false )const;

template<typename T, typename Resolver>
static void to_variant( const T& o, fc::variant& vo, Resolver resolver, const yield_function_t& yield );
template<typename T, typename Resolver>
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
static void to_variant( const T& o, fc::variant& vo, Resolver resolver, const fc::microseconds& max_serialization_time );

template<typename T, typename Resolver>
static void from_variant( const fc::variant& v, T& o, Resolver resolver, const yield_function_t& yield );
template<typename T, typename Resolver>
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
static void from_variant( const fc::variant& v, T& o, Resolver resolver, const fc::microseconds& max_serialization_time );

template<typename Vec>
static bool is_empty_abi(const Vec& abi_vec)
Expand Down Expand Up @@ -950,11 +930,6 @@ void abi_serializer::to_variant( const T& o, variant& vo, Resolver resolver, con
vo = std::move(mvo["_"]);
} FC_RETHROW_EXCEPTIONS(error, "Failed to serialize: ${type}", ("type", boost::core::demangle( typeid(o).name() ) ))

template<typename T, typename Resolver>
void abi_serializer::to_variant( const T& o, variant& vo, Resolver resolver, const fc::microseconds& max_serialization_time ) {
to_variant( o, vo, resolver, create_yield_function(max_serialization_time) );
}

template<typename T, typename Resolver>
void abi_serializer::from_variant( const variant& v, T& o, Resolver resolver, const yield_function_t& yield ) try {
static_assert( !std::is_same_v<T, packed_transaction>, "use packed_transaction_v0" );
Expand All @@ -963,10 +938,6 @@ void abi_serializer::from_variant( const variant& v, T& o, Resolver resolver, co
impl::abi_from_variant::extract(v, o, resolver, ctx);
} FC_RETHROW_EXCEPTIONS(error, "Failed to deserialize variant", ("variant",v))

template<typename T, typename Resolver>
void abi_serializer::from_variant( const variant& v, T& o, Resolver resolver, const fc::microseconds& max_serialization_time ) {
from_variant( v, o, resolver, create_yield_function(max_serialization_time) );
}


} } // eosio::chain

0 comments on commit 34d7bd9

Please sign in to comment.