If we were going to continue support for “whitelisted”, we should have probably made it true if any permission flag was set, rather than only if “default permissions” were used.
This corrects the description, and deprecates it.
If we were going to continue support for “whitelisted”, we should have probably made it true if any permission flag was set, rather than only if “default permissions” were used.
This corrects the description, and deprecates it.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
No conflicts as of last run.
118@@ -119,7 +119,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
119 {
120 {RPCResult::Type::NUM, "n", "The heights of blocks we're currently asking from this peer"},
121 }},
122- {RPCResult::Type::BOOL, "whitelisted", "Whether the peer is whitelisted"},
123+ {RPCResult::Type::BOOL, "whitelisted", /* optional */ true, "Whether the peer is whitelisted with default permissions (DEPRECATED)"},
Could mention when it is returned/not returned similar to bascore:
0src/rpc/net.cpp: {RPCResult::Type::NUM, "banscore", "The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed)"},
162@@ -150,10 +163,14 @@ def check_tx_relay(self):
163 )
164
165 def checkpermission(self, args, expectedPermissions, whitelisted):
166+ if whitelisted is not None: args = [*args, '-deprecatedrpc=whitelisted']
You’ll either need to fix the linter or this test.
0test/functional/p2p_permissions.py:166:35: E701 multiple statements on one line (colon)
Travis gives the following new Python lint error:
0test/functional/p2p_permissions.py:166:35: E701 multiple statements on one line (colon)
Edit: oh already reported.
32@@ -33,7 +33,6 @@ enabled=(
33 E401 # multiple imports on one line
34 E402 # module level import not at top of file
35 E502 # the backslash is redundant between brackets
36- E701 # multiple statements on one line (colon)
Necessary or not, this is our current code style for C++ and seems quite reasonable…
Where is the basis for banning it? It’s not like it’s dangerous syntax.
In C++, if code blocks are denoted by braces. Having a single line if statement indented without braces is dangerous because it’s easy to misread a subsequent indented line as part of the if block. These things have caused bugs in production systems, which is why the style guide disallows it.
Python is a completely different language. If blocks are denoted by indentation. The same considerations don’t apply.
Please remove this unnecessary style change.
cr ACK 531198bcef9f6213d588f8539dd05f4b1cca0781
No opinion on the linter, I am fine with either alternative.
118@@ -119,7 +119,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
119 {
120 {RPCResult::Type::NUM, "n", "The heights of blocks we're currently asking from this peer"},
121 }},
122- {RPCResult::Type::BOOL, "whitelisted", "Whether the peer is whitelisted"},
123+ {RPCResult::Type::BOOL, "whitelisted", /* optional */ true, "Whether the peer is whitelisted with default permissions (DEPRECATED, returned only if config option -deprecatedrpc=whitelisted is passed)"},
RPCHelpMan doesn’t (yet) add line breaks.
Regardless, this string will go away on November 1st, so no need to over-optimize something that will be removed.
NACK on the unrelated test/lint/lint-python.sh
change.
The PR author’s personal style preference is not a good reason to deviate from the well-established idiomatic style which the Python community has settled on and even formalised via PEP-8. Doing so would just open up for future bikeshedding where we currently run no such risk.
The language’s style guide (PEP-8, https://www.python.org/dev/peps/pep-0008/) couldn’t be more clear on this:
Compound statements (multiple statements on the same line) are generally discouraged
The change to permissions isn’t a terminology change its an important change in functionality which has been slowly progressing for years.
One of the original motivations for the whitelisting support was selectively bypassing banning/disconnection logic instead of doing so for everything localhost so you could be sure your own stuff didn’t get banned without losing your protections towards Tor peers.
But then armory was kind of broken and depended on its host node relaying its transactions no matter what and whitelisting (even by the time it was originally merged) gained the property of force relaying everything that the whitelisted peer sent. But actually made whitelist mostly unusable for the original purpose, because if you whitelisted ordinary nodes the whitelisting node would start spamming the crap out of other peers with redundant broadcasts. (it would even cause you to relay invalid transactions for a while and get yourself banned by other peers if any were sent to you from a whitelisted peer)
And so the tension has continued throughout all of whitelist’s life: people keep wanting to defeat some protection or limiter selectively for particular trusted peers or test harnessses, but then binning that same behaviour change in with all other whitelisted behaviour changes breaks your ability to use whitelisting for some other purpose where that particular behaviour change is highly undesirable. The only solution is to replace whitelisting with granular properties which can be applied on a connection-by-connection basis.
Don’t like the precedent for arbitrary style rules overriding readability, but regardless..
Both changes made.
58@@ -59,7 +59,7 @@ def run_test(self):
59
60 self.log.info('Check that txs from peers with relay-permission are not rejected and relayed to others')
61 self.log.info("Restarting node 0 with relay permission and blocksonly")
62- self.restart_node(0, ["-persistmempool=0", "-whitelist=relay@127.0.0.1", "-blocksonly"])
63+ self.restart_node(0, ["-persistmempool=0", "-whitelist=relay@127.0.0.1", "-blocksonly", '-deprecatedrpc=whitelisted'])
whitelist
field (in which case, use double quotes like the other args in this line).
whitelist
field has been asserted on before the rebase, so this is probably an unsolved silent conflict
I didn’t see a release note for this change, so I added some to the wiki
The getpeerinfo RPC no longer returns the whitelisted field by default. This field will be fully removed in the next major release. It can be accessed with the configuration option -deprecatedrpc=getpeerinfo_whitelisted. However, it is recommended to instead use the permissions field to understand if specific privileges have been granted to the peer. (#19770)
please let me know (or edit the wiki) if I’ve miscommunicated anything
luke-jr
DrahtBot
MarcoFalke
jonatack
laanwj
jnewbery
practicalswift
StopAndDecrypt
localcryptosMichael
gmaxwell
amitiuttarwar
Labels
RPC/REST/ZMQ
Milestone
0.21.0