diff --git a/libraries/protocol/CMakeLists.txt b/libraries/protocol/CMakeLists.txt index aaf9c512fd..2291a4560b 100644 --- a/libraries/protocol/CMakeLists.txt +++ b/libraries/protocol/CMakeLists.txt @@ -51,7 +51,9 @@ list(APPEND CUSTOM_AUTHS_FILES custom_authorities/list_9.cpp custom_authorities/list_10.cpp custom_authorities/list_11.cpp - custom_authorities/list_12.cpp) + custom_authorities/list_12.cpp + custom_authorities/list_13.cpp + custom_authorities/list_14.cpp) file(GLOB CUSTOM_AUTHS_HEADERS "custom_authorities/*.hxx") diff --git a/libraries/protocol/custom_authorities/list_13.cpp b/libraries/protocol/custom_authorities/list_13.cpp new file mode 100644 index 0000000000..8f77ec6ccd --- /dev/null +++ b/libraries/protocol/custom_authorities/list_13.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" +#include "sliced_lists.hxx" + +namespace graphene { namespace protocol { +using result_type = object_restriction_predicate; + +result_type get_restriction_predicate_list_13(size_t idx, vector rs) { + return typelist::runtime::dispatch(operation_list_13::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/list_14.cpp b/libraries/protocol/custom_authorities/list_14.cpp new file mode 100644 index 0000000000..b863cf8ed8 --- /dev/null +++ b/libraries/protocol/custom_authorities/list_14.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" +#include "sliced_lists.hxx" + +namespace graphene { namespace protocol { +using result_type = object_restriction_predicate; + +result_type get_restriction_predicate_list_14(size_t idx, vector rs) { + return typelist::runtime::dispatch(operation_list_14::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 10cc57709a..c0e177fd1a 100644 --- a/libraries/protocol/custom_authorities/restriction_predicate.cpp +++ b/libraries/protocol/custom_authorities/restriction_predicate.cpp @@ -56,6 +56,10 @@ restriction_predicate_function get_restriction_predicate(vector rs, return get_restriction_predicate_list_11(typelist::index_of(), std::move(rs)); if (typelist::contains()) return get_restriction_predicate_list_12(typelist::index_of(), std::move(rs)); + if (typelist::contains()) + return get_restriction_predicate_list_13(typelist::index_of(), std::move(rs)); + if (typelist::contains()) + return get_restriction_predicate_list_14(typelist::index_of(), std::move(rs)); if (typelist::contains()) FC_THROW_EXCEPTION( fc::assert_exception, "Virtual operations not allowed!" ); @@ -66,6 +70,7 @@ restriction_predicate_function get_restriction_predicate(vector rs, operation_list_7::list, operation_list_8::list, operation_list_9::list, operation_list_10::list, operation_list_11::list, operation_list_12::list, + operation_list_13::list, operation_list_14::list, virtual_operations_list::list>, Op>(), ""); FC_THROW_EXCEPTION(fc::assert_exception, diff --git a/libraries/protocol/custom_authorities/sliced_lists.hxx b/libraries/protocol/custom_authorities/sliced_lists.hxx index f26b3b77ef..9fbbc5afdc 100644 --- a/libraries/protocol/custom_authorities/sliced_lists.hxx +++ b/libraries/protocol/custom_authorities/sliced_lists.hxx @@ -46,7 +46,9 @@ using operation_list_11 = static_variant ::add_list> ::add // 52 ::finalize>; -using operation_list_12 = static_variant>; +using operation_list_12 = static_variant>; +using operation_list_13 = static_variant>; +using operation_list_14 = static_variant>; using virtual_operations_list = static_variant get_restriction_predicate_list_9(size_t object_restriction_predicate get_restriction_predicate_list_10(size_t idx, vector rs); object_restriction_predicate get_restriction_predicate_list_11(size_t idx, vector rs); object_restriction_predicate get_restriction_predicate_list_12(size_t idx, vector rs); +object_restriction_predicate get_restriction_predicate_list_13(size_t idx, vector rs); +object_restriction_predicate get_restriction_predicate_list_14(size_t idx, vector rs); } } // namespace graphene::protocol