Skip to content

Commit 4848fb2

Browse files
committed
Rename execution_mode to access_mode, and on_call_not_supported_mode to support_mode for simplicity
1 parent 79d466e commit 4848fb2

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

libraries/eosiolib/contracts/eosio/call.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ namespace eosio {
5151
internal_use_do_not_use::set_call_return_value(mem, len);
5252
}
5353

54-
// Request a sync call is read_write or read_only. Default is read_write
55-
enum execution_mode { read_write = 0, read_only = 1 };
54+
// Indicate whether a sync call is read_write or read_only. Default is read_write
55+
enum access_mode { read_write = 0, read_only = 1 };
5656

57-
// Behaviour of a sync call if the receiver does not support sync calls
57+
// Indicate the action to take if the receiver does not support sync calls.
5858
// Default is abort
59-
enum on_call_not_supported_mode { abort = 0, no_op = 1 };
59+
enum support_mode { abort = 0, no_op = 1 };
6060

6161
struct call_data_header {
6262
uint32_t version = 0;
@@ -80,7 +80,7 @@ namespace eosio {
8080
* get();
8181
* @endcode
8282
*/
83-
template <eosio::name::raw Func_Name, auto Func_Ref, execution_mode Exec_Mode=execution_mode::read_write, on_call_not_supported_mode Not_Supported_Mode = on_call_not_supported_mode::abort>
83+
template <eosio::name::raw Func_Name, auto Func_Ref, access_mode Access_Mode=access_mode::read_write, support_mode Support_Mode = support_mode::abort>
8484
struct call_wrapper {
8585
template <typename Receiver>
8686
constexpr call_wrapper(Receiver&& receiver)
@@ -97,7 +97,7 @@ namespace eosio {
9797
static_assert(detail::type_check<Func_Ref, Args...>());
9898

9999
uint64_t flags = 0x00;
100-
if constexpr (Exec_Mode == execution_mode::read_only) {
100+
if constexpr (Access_Mode == access_mode::read_only) {
101101
flags = 0x01;
102102
}
103103

@@ -109,15 +109,15 @@ namespace eosio {
109109
auto ret_val_size = internal_use_do_not_use::call(receiver.value, flags, data.data(), data.size());
110110

111111
if (ret_val_size < 0) {
112-
if constexpr (Not_Supported_Mode == on_call_not_supported_mode::abort) {
113-
check(false, "receiver does not support sync call while on_call_not_supported_mode is set to abort");
112+
if constexpr (Support_Mode == support_mode::abort) {
113+
check(false, "receiver does not support sync call but support_mode is set to abort");
114114
} else {
115115
if constexpr (std::is_void<ret_type>::value) {
116116
return;
117117
} else if constexpr (std::is_default_constructible_v<ret_type>) {
118118
return {};
119119
} else {
120-
static_assert(std::is_default_constructible_v<ret_type>, "Return type of on_call_not_supported_mode::no_op function must be default constructible");
120+
static_assert(std::is_default_constructible_v<ret_type>, "Return type of support_mode::no_op function must be default constructible");
121121
}
122122
}
123123
}

tests/integration/call_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(sync_call_not_supported_test) { try {
153153
// on_call_not_supported_mode is passed in as abort, so the call aborts
154154
BOOST_CHECK_EXCEPTION(t.push_action("caller"_n, "abortifnot"_n, "caller"_n, {}),
155155
eosio_assert_message_exception,
156-
fc_exception_message_contains("receiver does not support sync call while on_call_not_supported_mode is set to abort"));
156+
fc_exception_message_contains("receiver does not support sync call but support_mode is set to abort"));
157157
} FC_LOG_AND_RETHROW() }
158158

159159
// Verify header validation

tests/unit/test_contracts/sync_call_addr_book_callee.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class [[eosio::contract]] sync_call_addr_book_callee : public eosio::contract {
1616
[[eosio::call]]
1717
person_info get(eosio::name user);
1818

19-
using upsert_read_only_func = eosio::call_wrapper<"upsert"_n, &sync_call_addr_book_callee::upsert, eosio::execution_mode::read_only>;
19+
using upsert_read_only_func = eosio::call_wrapper<"upsert"_n, &sync_call_addr_book_callee::upsert, eosio::access_mode::read_only>;
2020
using upsert_func = eosio::call_wrapper<"upsert"_n, &sync_call_addr_book_callee::upsert>;
2121
using get_func = eosio::call_wrapper<"get"_n, &sync_call_addr_book_callee::get>;
2222

tests/unit/test_contracts/sync_call_not_supported.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class [[eosio::contract]] sync_call_not_supported : public eosio::contract{
1212
void dummy() {
1313
}
1414
using dummy_func = eosio::call_wrapper<"dummy"_n, &sync_call_not_supported::dummy>;
15-
using dummy_no_op_func = eosio::call_wrapper<"dummy"_n, &sync_call_not_supported::dummy, eosio::execution_mode::read_write, eosio::on_call_not_supported_mode::no_op>;
15+
using dummy_no_op_func = eosio::call_wrapper<"dummy"_n, &sync_call_not_supported::dummy, eosio::access_mode::read_write, eosio::support_mode::no_op>;
1616

1717
// request no-op
1818
[[eosio::action]]

0 commit comments

Comments
 (0)