Skip to content

Commit

Permalink
Merge #6220: backport: Merge bitcoin#18448,24433, 24139, 23001, (part…
Browse files Browse the repository at this point in the history
…ial) 24339, (partial) core/gui#420

1a12ef1 (partial)Merge bitcoin-core/gui#420: Ensure translator comments end in full stop (Hennadii Stepanov)
d891d3c (partial) Merge bitcoin#24339: rpc: Improve RPC help by explicitly mentioning output types (MarcoFalke)
2372799 Merge bitcoin#23001: doc: Enable TLS in links in documentation (fanquake)
e4c8ea5 Merge bitcoin#24139: Avoid unsigned integer overflow in bitcoin-tx (MarcoFalke)
98f7e82 Merge bitcoin#24433: doc: Explain that feedback needs to be addressed (fanquake)
a3a4f63 Merge bitcoin#18448: rpc: fix/add missing RPCExamples for "Util" RPCs (MarcoFalke)

Pull request description:

  btc backports

ACKs for top commit:
  PastaPastaPasta:
    utACK 1a12ef1

Tree-SHA512: 4e3c4414d4db6ea355c336a9a6b30a26b628b607cbac51b7e17366cc1e6e8ba0aeb8af88529d018107482bdfb60bbd12b6d66e8acaaa1d6b21b4b06e0929b899
  • Loading branch information
PastaPastaPasta committed Sep 27, 2024
2 parents bd27f65 + 1a12ef1 commit 8e32dd8
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 34 deletions.
26 changes: 17 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ revolves around a meritocracy where contributors earn trust from the developer
community over time. Nevertheless, some hierarchy is necessary for practical
purposes. As such, there are repository "maintainers" who are responsible for
merging pull requests, as well as a "lead maintainer" who is responsible for the
release cycle as well as overall merging, moderation and appointment of
maintainers.
[release cycle](/doc/release-process.md) as well as overall merging, moderation
and appointment of maintainers.

Getting Started
---------------
Expand Down Expand Up @@ -169,9 +169,14 @@ in the body of the pull request to indicate tasks are pending.

At this stage, one should expect comments and review from other contributors. You
can add more commits to your pull request by committing them locally and pushing
to your fork until you have satisfied all feedback.
to your fork.

Note: Code review is a burdensome but important part of the development process, and as such, certain types of pull requests are rejected. In general, if the **improvements** do not warrant the **review effort** required, the PR has a high chance of being rejected. It is up to the PR author to convince the reviewers that the changes warrant the review effort, and if reviewers are "Concept NACK'ing" the PR, the author may need to present arguments and/or do research backing their suggested changes.
You are expected to reply to any review comments before your pull request is
merged. You may update the code or reject the feedback if you do not agree with
it, but you should express so in a reply. If there is outstanding feedback and
you are not actively working on it, your pull request may be closed.

Please refer to the [peer review](#peer-review) section below for more details.

### Squashing Commits

Expand Down Expand Up @@ -302,6 +307,14 @@ maintainers take into account the peer review when determining if there is
consensus to merge a pull request (remember that discussions may have been
spread out over GitHub, mailing list and IRC discussions).

Code review is a burdensome but important part of the development process, and
as such, certain types of pull requests are rejected. In general, if the
**improvements** do not warrant the **review effort** required, the PR has a
high chance of being rejected. It is up to the PR author to convince the
reviewers that the changes warrant the review effort, and if reviewers are
"Concept NACK'ing" the PR, the author may need to present arguments and/or do
research backing their suggested changes.

#### Conceptual Review

A review can be a conceptual review, where the reviewer leaves a comment
Expand Down Expand Up @@ -482,11 +495,6 @@ the contents onto the [Tracker](https://docs.google.com/spreadsheets/d/1DnKxat0S

When pasting the contents, make sure to split the values into the cells so every line is not present under commit hash.

Release Policy
--------------

The project leader is the release manager for each Dash Core release.

Copyright
---------

Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ This is especially notable because Ubuntu Focal packages `libgit2 v0.28.4`, and
Should you be in this situation, you need to build both `libgit2 v1.1.x` and
`guile-git` from source.

Source: http://logs.guix.gnu.org/guix/2020-11-12.log#232527
Source: https://logs.guix.gnu.org/guix/2020-11-12.log#232527

##### `{scheme,guile}-bytestructures` v1.0.8 and v1.0.9 are broken for Guile v2.2

Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,6 @@ used.
If you start `guix-daemon` using an init script, you can edit said script to
supply this flag.

[b17e]: http://bootstrappable.org/
[b17e]: https://bootstrappable.org/
[r12e/source-date-epoch]: https://reproducible-builds.org/docs/source-date-epoch/
[env-vars-list]: #recognized-environment-variables
2 changes: 1 addition & 1 deletion doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ make cov

Profiling is a good way to get a precise idea of where time is being spent in
code. One tool for doing profiling on Linux platforms is called
[`perf`](http://www.brendangregg.com/perf.html), and has been integrated into
[`perf`](https://www.brendangregg.com/perf.html), and has been integrated into
the functional test framework. Perf can observe a running process and sample
(at some frequency) where its execution is.

Expand Down
7 changes: 5 additions & 2 deletions src/bitcoin-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,16 @@ static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strIn
if (pos==0)
throw std::runtime_error("TX output value not specified");

if (pos != std::string::npos) {
if (pos == std::string::npos) {
pos = 0;
} else {
// Extract and validate VALUE
value = ExtractAndValidateValue(strInput.substr(0, pos));
++pos;
}

// extract and validate DATA
std::string strData = strInput.substr(pos + 1, std::string::npos);
const std::string strData{strInput.substr(pos, std::string::npos)};

if (!IsHex(strData))
throw std::runtime_error("invalid TX output data");
Expand Down
2 changes: 1 addition & 1 deletion src/qt/addressbookpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void AddressBookPage::on_exportButton_clicked()
QString filename = GUIUtil::getSaveFileName(this,
tr("Export Address List"), QString(),
/*: Expanded name of the CSV file format.
See https://en.wikipedia.org/wiki/Comma-separated_values */
See: https://en.wikipedia.org/wiki/Comma-separated_values. */
tr("Comma separated file") + QLatin1String(" (*.csv)"), nullptr);

if (filename.isNull())
Expand Down
2 changes: 1 addition & 1 deletion src/qt/qrimagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void QRImageWidget::saveImage()
QString fn = GUIUtil::getSaveFileName(
this, tr("Save QR Code"), QString(),
/*: Expanded name of the PNG file format.
See https://en.wikipedia.org/wiki/Portable_Network_Graphics */
See: https://en.wikipedia.org/wiki/Portable_Network_Graphics. */
tr("PNG Image") + QLatin1String(" (*.png)"), nullptr);
if (!fn.isEmpty())
{
Expand Down
2 changes: 1 addition & 1 deletion src/qt/transactionview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void TransactionView::exportClicked()
QString filename = GUIUtil::getSaveFileName(this,
tr("Export Transaction History"), QString(),
/*: Expanded name of the CSV file format.
See https://en.wikipedia.org/wiki/Comma-separated_values */
See: https://en.wikipedia.org/wiki/Comma-separated_values. */
tr("Comma separated file") + QLatin1String(" (*.csv)"), nullptr);

if (filename.isNull())
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,8 @@ static RPCHelpMan estimatesmartfee()
"have been observed to make an estimate for any number of blocks."},
}},
RPCExamples{
HelpExampleCli("estimatesmartfee", "6")
HelpExampleCli("estimatesmartfee", "6") +
HelpExampleRpc("estimatesmartfee", "6")
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand Down
13 changes: 10 additions & 3 deletions src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ static RPCHelpMan createmultisig()
"\nCreate a multisig address from 2 public keys\n"
+ HelpExampleCli("createmultisig", "2 \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("createmultisig", "2, \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"")
+ HelpExampleRpc("createmultisig", "2, [\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\",\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\"]")
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand Down Expand Up @@ -345,6 +345,8 @@ static RPCHelpMan createmultisig()

static RPCHelpMan getdescriptorinfo()
{
const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)";

return RPCHelpMan{"getdescriptorinfo",
{"\nAnalyses a descriptor.\n"},
{
Expand All @@ -362,7 +364,9 @@ static RPCHelpMan getdescriptorinfo()
},
RPCExamples{
"\nAnalyse a descriptor\n"
+ HelpExampleCli("getdescriptorinfo", "\"pkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)\"")
+ HelpExampleCli("getdescriptorinfo", "\"" + EXAMPLE_DESCRIPTOR + "\"") +
HelpExampleRpc("getdescriptorinfo", "\"" + EXAMPLE_DESCRIPTOR + "\"")

},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand All @@ -389,6 +393,8 @@ static RPCHelpMan getdescriptorinfo()

static RPCHelpMan deriveaddresses()
{
const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu";

return RPCHelpMan{"deriveaddresses",
"\nDerives one or more addresses corresponding to an output descriptor.\n"
"Examples of output descriptors are:\n"
Expand All @@ -410,7 +416,8 @@ static RPCHelpMan deriveaddresses()
},
RPCExamples{
"\nFirst three receive addresses\n"
+ HelpExampleCli("deriveaddresses", "\"pkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu\" \"[0,2]\"")
+ HelpExampleCli("deriveaddresses", "\"" + EXAMPLE_DESCRIPTOR + "\" \"[0,2]\"") +
HelpExampleRpc("deriveaddresses", "\"" + EXAMPLE_DESCRIPTOR + "\", \"[0,2]\"")
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand Down
10 changes: 0 additions & 10 deletions src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,16 +867,6 @@ static RPCHelpMan decoderawtransaction()
};
}

static std::string GetAllOutputTypes()
{
std::vector<std::string> ret;
using U = std::underlying_type<TxoutType>::type;
for (U i = (U)TxoutType::NONSTANDARD; i <= (U)TxoutType::NULL_DATA; ++i) {
ret.emplace_back(GetTxnOutputType(static_cast<TxoutType>(i)));
}
return Join(ret, ", ");
}

static RPCHelpMan decodescript()
{
return RPCHelpMan{"decodescript",
Expand Down
10 changes: 10 additions & 0 deletions src/rpc/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
const std::string UNIX_EPOCH_TIME = "UNIX epoch time";
const std::string EXAMPLE_ADDRESS[2] = {"XunLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPw0", "XwQQkwA4FYkq2XERzMY2CiAZhJTEDAbtc0"};

std::string GetAllOutputTypes()
{
std::vector<std::string> ret;
using U = std::underlying_type<TxoutType>::type;
for (U i = (U)TxoutType::NONSTANDARD; i <= (U)TxoutType::NULL_DATA; ++i) {
ret.emplace_back(GetTxnOutputType(static_cast<TxoutType>(i)));
}
return Join(ret, ", ");
}

void RPCTypeCheck(const UniValue& params,
const std::list<UniValueType>& typesExpected,
bool fAllowNull)
Expand Down
7 changes: 7 additions & 0 deletions src/rpc/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class CPubKey;
class CScript;
struct Sections;

/**
* Gets all existing output types formatted for RPC help sections.
*
* @return Comma separated string representing output type names.
*/
std::string GetAllOutputTypes();

/** Wrapper for UniValue::VType, which includes typeAny:
* Used to denote don't care type. */
struct UniValueType {
Expand Down
2 changes: 1 addition & 1 deletion src/test/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ License

The data files in this directory are distributed under the MIT software
license, see the accompanying file COPYING or
http://www.opensource.org/licenses/mit-license.php.
https://www.opensource.org/licenses/mit-license.php.

2 changes: 1 addition & 1 deletion test/functional/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,5 @@ perf report -i /path/to/datadir/send-big-msgs.perf.data.xxxx --stdio | c++filt |
#### See also:

- [Installing perf](https://askubuntu.com/q/50145)
- [Perf examples](http://www.brendangregg.com/perf.html)
- [Perf examples](https://www.brendangregg.com/perf.html)
- [Hotspot](https://github.com/KDAB/hotspot): a GUI for perf output analysis
1 change: 0 additions & 1 deletion test/sanitizer_suppressions/ubsan
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ unsigned-integer-overflow:addrman.cpp
unsigned-integer-overflow:arith_uint256.h
unsigned-integer-overflow:basic_string.h
unsigned-integer-overflow:bench/bench.h
unsigned-integer-overflow:bitcoin-tx.cpp
unsigned-integer-overflow:bloom.cpp
unsigned-integer-overflow:chain.cpp
unsigned-integer-overflow:chain.h
Expand Down

0 comments on commit 8e32dd8

Please sign in to comment.