-
Notifications
You must be signed in to change notification settings - Fork 38.8k
refactor: Remove all policy globals #25648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "2207-burn-globals-\u{1F6F6}"
Conversation
fa614d3 to
fa3b8a8
Compare
|
Approach ACK |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK |
glozow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach ACK
MemPoolOptions seems like the correct place to put these things since full_rbf is already there.
I would put ::incrementalRelayFee, ::minRelayFee, dustRelayFee, fIsBareMultisigStd in the same boat (sorry for scope creep, probably for a future PR).
c29eb24 to
fa775db
Compare
fa97170 to
fa642b5
Compare
Thx, all done here |
darosior
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Concept ACK.
glozow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed up to fac940af80a5e8babc9da79843f324147d8e41f5
fa10c83 to
721df35
Compare
glozow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fa727f139c38e24fa23a6455b0b274177b41747c
Lightly reviewed and tested each commit, nice move and cleanup. Would like at least another reviewer to take a look.
src/mempool_args.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fad51d5dac5b1da1540dd233c6bd096cb3e4a2a5, not changed by this PR, but interesting to note that incremental relay feerate must be set before min relay feerate.
src/script/standard.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with the approach of optional in fac85fe0632eace9b49d5bdbc0e9e47765b01090 👍. At first was unsure about introducing a global g_max_datacarrier_bytes, then realized it was moved into policy in fa727f139c38e24fa23a6455b0b274177b41747c.
darosior
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK fa727f139c38e24fa23a6455b0b274177b41747c
src/rpc/net.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we open an issue for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I think it is fine to keep them forever, unless there is a strong enough reason to remove them. But this seems to be subjective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondered at first look if launching bitcoind with -blocksonly would make these fields optional but doesn't appear to be the case (and checked that bitcoin-cli -rpcwait getnetworkinfo on a -blocksonly startup returns the fields).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that -blocksonly does not mean your node doesn't create a mempool.
Also pass in a (for now unused) reference to the params. Both changes are needed for the next commit.
Apart from tests, it is only used in one place, so there is no need for an alias.
Each alias is only used in one place.
It is part of the node library. Also, it won't be moved to the kernel lib, as it will be pruned of ArgsManager. -BEGIN VERIFY SCRIPT- # Move module git mv src/mempool_args.cpp src/node/ git mv src/mempool_args.h src/node/ # Replacements sed -i 's:mempool_args\.h:node/mempool_args.h:g' $(git grep -l mempool_args) sed -i 's:mempool_args\.cpp:node/mempool_args.cpp:g' $(git grep -l mempool_args) sed -i 's:MEMPOOL_ARGS_H:NODE_MEMPOOL_ARGS_H:g' $(git grep -l MEMPOOL_ARGS_H) -END VERIFY SCRIPT-
fa727f1 to
ddddd69
Compare
|
Fixed doc typos and added two commits (let me know if I should drop them) |
ryanofsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK ddddd69
| * @param[in,out] mempool_opts The MemPoolOptions to modify according to \p argsman. | ||
| */ | ||
| void ApplyArgsManOptions(const ArgsManager& argsman, kernel::MemPoolOptions& mempool_opts); | ||
| [[nodiscard]] std::optional<bilingual_str> ApplyArgsManOptions(const ArgsManager& argsman, const CChainParams& chainparams, kernel::MemPoolOptions& mempool_opts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there are also a few other places. See git grep 'std::optional<bilingual_str>'.
| #include <boost/test/unit_test.hpp> | ||
|
|
||
| // Helpers: | ||
| bool IsStandardTx(const CTransaction& tx, std::string& reason) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "Remove ::IsStandardTx(tx, reason) alias" (fa8a7f0)
Would be good to declare this static to make sure nobody outside this file can call this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Will do on the next push or as a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #25772
ariard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Light Code Review ACK ddddd69
| */ | ||
| std::optional<unsigned> max_datacarrier_bytes{DEFAULT_ACCEPT_DATACARRIER ? std::optional{MAX_OP_RETURN_RELAY} : std::nullopt}; | ||
| bool permit_bare_multisig{DEFAULT_PERMIT_BAREMULTISIG}; | ||
| bool require_standard{true}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be nice to document variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All options are documented in the manpage. This one under -acceptnonstdtxn. Happy to review a docs pull if there is need for one and someone creates one.
| mempool_opts.max_datacarrier_bytes = std::nullopt; | ||
| } | ||
|
|
||
| mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be called require_txstandard we might have standard package in the future, good to dissociate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require_standard is applied to both txs and packages, so I think the current name is fine, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think package standardness would be included with -acceptnonstdtxn anyway, can't really think of a reason not to. Feel free to reopen if something changes, we can cross this bridge if/when we come to it.
| // Don't let discard_rate be greater than longest possible fee estimate if we get a valid fee estimate | ||
| discard_rate = (discard_rate == CFeeRate(0)) ? wallet.m_discard_rate : std::min(discard_rate, wallet.m_discard_rate); | ||
| // Discard rate must be at least dustRelayFee | ||
| // Discard rate must be at least dust relay feerate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_dust_relay_feerate we do so for other variables doc refs make the code more greppable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wallet.m_dust_relay_feerate doesn't exist, only wallet.chain().relayDustFee(). Happy to switch to relayDustFee or similar, or just remove the comment completely, as the code is self-explanatory. Just let me know.
|
re ACK ddddd69 changes since last review:
|
… helper fad5bc4 test: Add missing static to IsStandardTx helper (MacroFake) Pull request description: Requested in bitcoin/bitcoin#25648 (comment) Also remove line break from the other two helpers. ACKs for top commit: glozow: utACK fad5bc4 aureleoules: ACK fad5bc4. theStack: ACK fad5bc4 Tree-SHA512: 771411e1fb5939a58491ecf719e1929ab0150b0faae2078ac72bd13117f1d4dcffdeed5027bfae53e4336af25a4f1db47d564abc06a5a2c9ec006a9f67bae104
…al_str>` with `util::Result` 8aa8f73 refactor: Replace std::optional<bilingual_str> with util::Result (Ryan Ofsky) 5f49cb1 util: Add void support to util::Result (MarcoFalke) Pull request description: Replace uses of `std::optional<bilingual_str>` with `util::Result` as suggested bitcoin/bitcoin#25648 (comment), bitcoin/bitcoin#27632 (comment), bitcoin/bitcoin#27632 (comment), bitcoin/bitcoin#24313 (comment) ACKs for top commit: MarcoFalke: very nice ACK 8aa8f73 🏏 TheCharlatan: ACK 8aa8f73 hebasto: ACK 8aa8f73, I have reviewed the code and it looks OK. Tree-SHA512: 6c2f218bc445184ce93ec2b907e61666a05f26f2c9447f69fcb504aa8291b0c693d913f659dfd19813a9e24615546c72cbe2ca419218fd867ff0694c4a1b6a30
… with `util::Result` 8aa8f73 refactor: Replace std::optional<bilingual_str> with util::Result (Ryan Ofsky) 5f49cb1 util: Add void support to util::Result (MarcoFalke) Pull request description: Replace uses of `std::optional<bilingual_str>` with `util::Result` as suggested bitcoin#25648 (comment), bitcoin#27632 (comment), bitcoin#27632 (comment), bitcoin#24313 (comment) ACKs for top commit: MarcoFalke: very nice ACK 8aa8f73 🏏 TheCharlatan: ACK 8aa8f73 hebasto: ACK 8aa8f73, I have reviewed the code and it looks OK. Tree-SHA512: 6c2f218bc445184ce93ec2b907e61666a05f26f2c9447f69fcb504aa8291b0c693d913f659dfd19813a9e24615546c72cbe2ca419218fd867ff0694c4a1b6a30
This change is good because: