Skip to content

Commit

Permalink
Merge pull request #2482 from bitshares/limited-cust-auth-support
Browse files Browse the repository at this point in the history
Remove BSIP-40 support for some operations
  • Loading branch information
abitmore committed Jun 30, 2021
2 parents d5f3bfa + dd0b761 commit 2ce9037
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 317 deletions.
8 changes: 1 addition & 7 deletions libraries/protocol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,11 @@ list(APPEND CUSTOM_AUTHS_FILES
custom_authorities/list_1.cpp
custom_authorities/list_2.cpp
custom_authorities/list_3.cpp
custom_authorities/list_4.cpp
custom_authorities/list_5.cpp
custom_authorities/list_6.cpp
custom_authorities/list_7.cpp
custom_authorities/list_8.cpp
custom_authorities/list_9.cpp
custom_authorities/list_10.cpp
custom_authorities/list_11.cpp
custom_authorities/list_12.cpp
custom_authorities/list_13.cpp
custom_authorities/list_14.cpp)
custom_authorities/list_11.cpp)

file(GLOB CUSTOM_AUTHS_HEADERS "custom_authorities/*.hxx")

Expand Down
42 changes: 0 additions & 42 deletions libraries/protocol/custom_authorities/list_12.cpp

This file was deleted.

42 changes: 0 additions & 42 deletions libraries/protocol/custom_authorities/list_13.cpp

This file was deleted.

42 changes: 0 additions & 42 deletions libraries/protocol/custom_authorities/list_14.cpp

This file was deleted.

43 changes: 0 additions & 43 deletions libraries/protocol/custom_authorities/list_4.cpp

This file was deleted.

43 changes: 0 additions & 43 deletions libraries/protocol/custom_authorities/list_7.cpp

This file was deleted.

43 changes: 0 additions & 43 deletions libraries/protocol/custom_authorities/list_8.cpp

This file was deleted.

31 changes: 9 additions & 22 deletions libraries/protocol/custom_authorities/restriction_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,26 @@ restriction_predicate_function get_restriction_predicate(vector<restriction> rs,
return get_restriction_pred_list_2(typelist::index_of<operation_list_2::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_3::list, Op>())
return get_restriction_pred_list_3(typelist::index_of<operation_list_3::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_4::list, Op>())
return get_restriction_pred_list_4(typelist::index_of<operation_list_4::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_5::list, Op>())
return get_restriction_pred_list_5(typelist::index_of<operation_list_5::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_6::list, Op>())
return get_restriction_pred_list_6(typelist::index_of<operation_list_6::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_7::list, Op>())
return get_restriction_pred_list_7(typelist::index_of<operation_list_7::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_8::list, Op>())
return get_restriction_pred_list_8(typelist::index_of<operation_list_8::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_9::list, Op>())
return get_restriction_pred_list_9(typelist::index_of<operation_list_9::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_10::list, Op>())
return get_restriction_pred_list_10(typelist::index_of<operation_list_10::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_11::list, Op>())
return get_restriction_pred_list_11(typelist::index_of<operation_list_11::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_12::list, Op>())
return get_restriction_pred_list_12(typelist::index_of<operation_list_12::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_13::list, Op>())
return get_restriction_pred_list_13(typelist::index_of<operation_list_13::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_14::list, Op>())
return get_restriction_pred_list_14(typelist::index_of<operation_list_14::list, Op>(), std::move(rs));
if (typelist::contains<virtual_operations_list::list, Op>())
FC_THROW_EXCEPTION( fc::assert_exception, "Virtual operations not allowed!" );
if (typelist::contains<unsupported_operations_list::list, Op>())
FC_THROW_EXCEPTION( fc::assert_exception, "Unsupported operation detected!" );

// Compile time check that we'll never get to the exception below
static_assert(typelist::contains<typelist::concat<operation_list_1::list, operation_list_2::list,
operation_list_3::list, operation_list_4::list,
operation_list_3::list,
operation_list_5::list, operation_list_6::list,
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>,
operation_list_11::list,
unsupported_operations_list::list>,
Op>(), "");
FC_THROW_EXCEPTION(fc::assert_exception,
"LOGIC ERROR: Operation type not handled by custom authorities implementation. "
Expand All @@ -84,12 +70,13 @@ restriction_predicate_function get_restriction_predicate(vector<restriction> rs,
}

predicate_result& predicate_result::reverse_path() {
if (success == true)
if (success)
return *this;
auto reverse_subpaths = [](rejection_indicator& indicator) {
const auto reverse_subpaths = [](rejection_indicator& indicator) {
if (indicator.is_type<vector<predicate_result>>()) {
auto& results = indicator.get<vector<predicate_result>>();
for (predicate_result& result : results) result.reverse_path();
for (predicate_result& result : results)
result.reverse_path();
}
};
std::reverse(rejection_path.begin(), rejection_path.end());
Expand Down
Loading

0 comments on commit 2ce9037

Please sign in to comment.