HomePhabricator

refactor: Add explicit DISALLOW_NEGATION ArgsManager flag to clarify flag usage

Description

refactor: Add explicit DISALLOW_NEGATION ArgsManager flag to clarify flag usage

Summary:

Currently, ALLOW_{INT|BOOL|STRING} flags don't do any real validation,
so current uses of these flags are misleading and will also break
backwards compatibility whenever these flags are implemented in a future
PR (draft PR is #16545).

An additional complication is that while these flags don't do any real
settings validation, they do affect whether setting negation syntax is
allowed.

Fix this mess by disabling ALLOW_{INT|BOOL|STRING} flags until they are
implemented, and adding an unambiguous DISALLOW_NEGATION flag. This is
done in two commits, with this commit adding the DISALLOW_NEGATION flag,
and the next commit disabling the ALLOW_{INT|BOOL|STRING} flags.

https://github.com/bitcoin/bitcoin/pull/22766/commits/c5d7e34bd9a4ad752c5ec88032420e2e90ab17ab

scripted-diff: disable unimplemented ArgsManager BOOL/INT/STRING flags

This commit does not change behavior in any way. See previous commit for
complete rationale, but these flags are being disabled because they
aren't implemented and will otherwise break backwards compatibility when
they are implemented.

-BEGIN VERIFY SCRIPT-
sed -i 's:\(ALLOW_.*\) \(!< unimplemented\): \1\2:' src/util/system.h
sed -i '/DISALLOW_NEGATION.*scripted-diff/d' src/util/system.cpp
git grep -l 'ArgsManager::ALLOW_\(INT\|STRING\)' | xargs sed -i 's/ArgsManager::ALLOW_\(INT\|STRING\)/ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION/g'
git grep -l 'ALLOW_BOOL' -- ':!src/util/system.h' | xargs sed -i 's/ALLOW_BOOL/ALLOW_ANY/g'
-END VERIFY SCRIPT-

https://github.com/bitcoin/bitcoin/pull/22766/commits/26a50ab322614bceb5bc62e2c282f83e5987bad8

This concludes backport of core#22766
Depends on D18259

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18260

Details

Provenance
Russell Yanofsky <russ@yanofsky.org>Authored on Aug 21 2021, 18:06
PiRKCommitted on Jun 17 2025, 13:20
PiRKPushed on Jun 17 2025, 13:20
Reviewer
Restricted Project
Differential Revision
D18260: refactor: Add explicit DISALLOW_NEGATION ArgsManager flag to clarify flag usage
Parents
rABC31a27f56d4f0: refactor: Split InterpretOption into Interpret{Key,Value} functions
Branches
Unknown
Tags
Unknown