mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:47:36 +00:00
cli: Parse -signetchallenge like bitcoind #36689
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36689
Loading…
Reference in a new issue
No description provided.
Delete branch "bitcoin-cli-signetchallenge-validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
bitcoindreturns an useful error when invalid hex is passed to-signetchallenge:The error returned by
bitcoin-clionly indicates that the RPC cookie wasn't found. It doesn't hint at invalid hex:To have consistent validation of signet args in
bitcoindandbitcoin-cli, we now parse-signetchallengein a newReadSignetChallengeArg()function which is called inGetSignetDataDir()andReadSigNetArgs().Addresses https://github.com/bitcoin/bitcoin/pull/34566#discussion_r3668123074
I didn't add a release note because I don't think this change of an error message warrants one.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
No conflicts as of last run.
No verified findings are available from this review.
Review coverage was incomplete.
Reviewed:
28c2561c9c10· Review report · Previous reportspermalink
Optional test suggestion: set
signetchallenge=51in the[signet]config section and also pass-signetchallenge=51on the command line, then assert the multiple-values error.This would cover the
GetArg()->GetArgs()change across configuration sources, using valid, identical values. Running this case with RPC unavailable would also verify that the diagnostic does not depend on a running node.Thanks! I replaced the CLI test which passes the same invalid value twice (
-signetchallenge=abc) with a test that usessignetchallenge=51from the config and passes the same valid value (-signetchallenge=51) incb7bb77a10, as you suggested.I checked if we're using patterns like here which could be refactored with context managers, but there's only one similar case I've found at interface_bitcoin_cli.py:205 where we comment out
rpcportin the config before running some tests and restoring it.In the other cases, we're either restarting the node with the new changes (so undo is undesired) or
node.replace_in_config()is more ergonomic.So in case someone has more context than me to still consider this a good idea: This and similar patterns could be refactored with a context manager like this:
Concept ACK
Consider splitting
cb7bb77a10into a pure refactor to extract the helper(s) you need, followed by the change itself.I suggest dropping the rename in
38998ad410. It's going to invite bike-shedding (and personally I prefer Signet over SigNet).Dropped the rename.1
23a88a4now introducesReadSignetChallengeArg()and54fe0ecthen uses it inReadSignetDataDir()with tests. Updated commit messages accordingly.I also prefer Signet but I think I should have favoured consistency in #34566 instead of introducing Signet over SigNet ↩︎
🐙 This pull request conflicts with the target branch and needs rebase.
28c2561c9c: rebased on master (442b152c8b)Only conflict was in chainparamsbase.cpp:
include <cassert>was replaced withinclude <util/check.h>.