refactor: use new type of composite commands for protx NNN#6072
Merged
PastaPastaPasta merged 5 commits intodashpay:developfrom Jun 27, 2024
Merged
refactor: use new type of composite commands for protx NNN#6072PastaPastaPasta merged 5 commits intodashpay:developfrom
PastaPastaPasta merged 5 commits intodashpay:developfrom
Conversation
82e524d to
e96776a
Compare
|
This pull request has conflicts, please rebase. |
e96776a to
7b44af2
Compare
knst
added a commit
to knst/dash
that referenced
this pull request
Dec 27, 2024
The implementation of RPC has been refactored in bitcoin significantly with using RPCHelpMan, see multiple PR, such as bitcoin#1853, bitcoin#19528, etc Backporting them and appliying same refactoring to Dash Core caused undefined behaviour, particularly dashpay#6072 For example, in this code the local variable `use_legacy` will be used after `protx_update_registrar_wrapper`, when executor will be called. static RPCHelpMan protx_update_registrar_wrapper(const bool use_legacy) { std::string rpc_name = use_legacy ? "update_registrar_legacy" : "update_registrar"; std::string rpc_full_name = std::string("protx ").append(rpc_name); std::string pubkey_operator = use_legacy ? "\"0532646990082f4fd639f90387b1551f2c7c39d37392cb9055a06a7e85c1d23692db8f87f827886310bccc1e29db9aee\"" : "\"8532646990082f4fd639f90387b1551f2c7c39d37392cb9055a06a7e85c1d23692db8f87f827886310bccc1e29db9aee\""; std::string rpc_example = rpc_name.append(" \"0123456701234567012345670123456701234567012345670123456701234567\" ").append(pubkey_operator).append(" \"" + EXAMPLE_ADDRESS[1] + "\""); return RPCHelpMan{rpc_full_name, <...> RPCResult{ RPCResult::Type::STR_HEX, "txid", "The transaction id" }, RPCExamples{ HelpExampleCli("protx", rpc_example) }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { <...> ptx.nVersion = specific_legacy_bls_scheme ? CProUpRegTx::LEGACY_BLS_VERSION : CProUpRegTx::BASIC_BLS_VERSION; <<<<---- THERE IS UB It can be easy tested by adding debug logs to log string, for example rpc_full_name at the moment of call of executor has been during run: 2024-12-26T16:10:15Z rpc full name: 'r,ߧzu\x00\x00����m���istrar_legacy' This PR fixes multiple unexplainable random failures which had happen only for `tsan` build or for only `ubsan` build during debuggin dashpay#6508 and depends only on code revision.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
See #6051
What was done?
Commands starting from 'protx ...' uses new a new way to make composite commands.
How Has This Been Tested?
Run unit/functional tests.
Breaking Changes
N/A
Checklist: