diff --git a/libraries/protocol/CMakeLists.txt b/libraries/protocol/CMakeLists.txt index 877a1afc9f..78a6af8fc6 100644 --- a/libraries/protocol/CMakeLists.txt +++ b/libraries/protocol/CMakeLists.txt @@ -39,7 +39,8 @@ list(APPEND CUSTOM_AUTHS_FILES custom_authorities/list_4.cpp custom_authorities/list_5.cpp custom_authorities/list_6.cpp - custom_authorities/list_7.cpp) + custom_authorities/list_7.cpp + custom_authorities/list_8.cpp) add_library( graphene_protocol_custom_auths ${CUSTOM_AUTHS_FILES} ) target_link_libraries( graphene_protocol_custom_auths fc ) diff --git a/libraries/protocol/custom_authorities/list_8.cpp b/libraries/protocol/custom_authorities/list_8.cpp new file mode 100644 index 0000000000..2244f00133 --- /dev/null +++ b/libraries/protocol/custom_authorities/list_8.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019 Contributors. + * + * The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "restriction_predicate.hxx" + +namespace graphene { namespace protocol { + +using result_type = object_restriction_predicate; + +result_type get_restriction_predicate_list_8(size_t idx, vector rs) { + return typelist::runtime::dispatch(operation_list_8::list(), idx, [&rs] (auto t) -> result_type { + using Op = typename decltype(t)::type; + return [p=restrictions_to_predicate(std::move(rs), true)] (const operation& op) { + FC_ASSERT(op.which() == operation::tag::value, + "Supplied operation is incorrect type for restriction predicate"); + return p(op.get()); + }; + }); +} +} } diff --git a/libraries/protocol/custom_authorities/restriction_predicate.cpp b/libraries/protocol/custom_authorities/restriction_predicate.cpp index 1b1094b3aa..7328a1b7a8 100644 --- a/libraries/protocol/custom_authorities/restriction_predicate.cpp +++ b/libraries/protocol/custom_authorities/restriction_predicate.cpp @@ -45,12 +45,15 @@ restriction_predicate_function get_restriction_predicate(vector rs, return get_restriction_predicate_list_6(typelist::index_of(), std::move(rs)); if (typelist::contains()) return get_restriction_predicate_list_7(typelist::index_of(), std::move(rs)); + if (typelist::contains()) + return get_restriction_predicate_list_8(typelist::index_of(), std::move(rs)); // Compile time check that we'll never get to the exception below static_assert(typelist::contains, Op>(), ""); + operation_list_7::list, operation_list_8::list>, + Op>(), ""); FC_THROW_EXCEPTION(fc::assert_exception, "LOGIC ERROR: Operation type not handled by custom authorities implementation. " "Please report this error."); diff --git a/libraries/protocol/custom_authorities/restriction_predicate.hxx b/libraries/protocol/custom_authorities/restriction_predicate.hxx index c32741db09..5fa7f1ff14 100644 --- a/libraries/protocol/custom_authorities/restriction_predicate.hxx +++ b/libraries/protocol/custom_authorities/restriction_predicate.hxx @@ -594,9 +594,10 @@ using operation_list_1 = static_variant>; using operation_list_2 = static_variant>; using operation_list_3 = static_variant>; using operation_list_4 = static_variant>; -using operation_list_5 = static_variant>; -using operation_list_6 = static_variant>; -using operation_list_7 = static_variant>; +using operation_list_5 = static_variant>; +using operation_list_6 = static_variant>; +using operation_list_7 = static_variant>; +using operation_list_8 = static_variant>; object_restriction_predicate get_restriction_predicate_list_1(size_t idx, vector rs); object_restriction_predicate get_restriction_predicate_list_2(size_t idx, vector rs); @@ -605,5 +606,6 @@ object_restriction_predicate get_restriction_predicate_list_4(size_t object_restriction_predicate get_restriction_predicate_list_5(size_t idx, vector rs); object_restriction_predicate get_restriction_predicate_list_6(size_t idx, vector rs); object_restriction_predicate get_restriction_predicate_list_7(size_t idx, vector rs); +object_restriction_predicate get_restriction_predicate_list_8(size_t idx, vector rs); } } // namespace graphene::protocol