Skip to content

Commit 9f942af

Browse files
authored
Merge pull request #1752 from AntelopeIO/get_sender_pf
[2.0.0-dev1.1] Introduce get_sender_fix protocol feature to enable get_sender() fix
2 parents dc95de4 + 72a15f4 commit 9f942af

File tree

9 files changed

+265
-244
lines changed

9 files changed

+265
-244
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ set( CXX_STANDARD_REQUIRED ON)
1616
set(VERSION_MAJOR 2)
1717
set(VERSION_MINOR 0)
1818
set(VERSION_PATCH 0)
19-
set(VERSION_SUFFIX dev1)
19+
set(VERSION_SUFFIX dev1.1)
2020

2121
if(VERSION_SUFFIX)
2222
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")

libraries/chain/include/eosio/chain/protocol_feature_manager.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum class builtin_protocol_feature_t : uint32_t {
4040
disable_deferred_trxs_stage_2 = 23,
4141
savanna = 24,
4242
sync_call = 25,
43+
get_sender_fix = 26,
4344
reserved_private_fork_protocol_features = 500000,
4445
};
4546

libraries/chain/protocol_feature_manager.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,17 @@ Enables synchronous calls to functions in other and own contracts.
374374
*/
375375
{builtin_protocol_feature_t::savanna}
376376
} )
377+
( builtin_protocol_feature_t::get_sender_fix, builtin_protocol_feature_spec{
378+
"GET_SENDER_FIX",
379+
fc::variant("0b464eee7952bf848ff8e3d33b8800b6aae22ad4e08e9195bc0a9528532ca4a4").as<digest_type>(),
380+
// SHA256 hash of the raw message below within the comment delimiters (exclude newline after /*) (do not modify message below).
381+
/*
382+
Builtin protocol feature: GET_SENDER_FIX
383+
384+
Enables get_sender() fix only for dev-testnet1 during 2.0.0-dev1 testing phase. This will never be merged back to 2.0.
385+
*/
386+
{builtin_protocol_feature_t::sync_call}
387+
} )
377388
;
378389

379390

libraries/chain/sync_call_context.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ void sync_call_context::set_call_return_value(std::span<const char> rv) {
4949

5050
// Returns the sender of any sync call initiated by this apply_context or sync_call_ctx
5151
action_name sync_call_context::get_sender() const {
52-
// The sync call is initiated by this apply_context or its sync_call_ctx.
53-
// That's why the context's receiver is the sender of the sync call.
54-
return receiver;
52+
// This is only a temporary fix for dev-testnet1.
53+
// It will never be merged back to any release branches.
54+
if (control.is_builtin_activated(builtin_protocol_feature_t::get_sender_fix)) {
55+
return sender;
56+
} else {
57+
return receiver;
58+
}
5559
}
5660

5761
void sync_call_context::console_append(std::string_view val) {

unittests/deep-mind/deep-mind.log

Lines changed: 245 additions & 240 deletions
Large diffs are not rendered by default.
0 Bytes
Binary file not shown.
196 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
104 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)