init: add -norangeproofcache startup option to disable range proof cache
What changed, and why it matters
This commit adds a new command-line option `-norangeproofcache` that lets node operators turn off an internal performance cache used when validating confidential transaction range proofs. It is a debug/test option, not a security fix. There is no evidence in the commit or supplied references that this change addresses a vulnerability or that disabling the cache is security-relevant.
No security action required. Treat as a routine feature/operational option. If reviewing for hardening, consider whether disabling the cache materially affects DoS resistance, but the commit itself provides no indication of a security problem.
Security signals we found
No security-relevant signal in commit message or diff
New debug/test startup option only
No validation logic change; only cache lookup/store paths are bypassed
No vendor or researcher attribution for a security issue
Evidence from the diff
The patch introduces a boolean startup argument -rangeproofcache (default true, disable with -norangeproofcache) in src/init.cpp and checks it in src/script/sigcache.cpp. InitRangeproofCache() early-returns without allocating cache memory when disabled, and CachingRangeProofChecker::VerifyRangeProof() skips cache lookup and insertion on each call. This is a configuration/operational knob for the existing range proof cache; it does not alter cryptographic validation logic or fix any identified bug.
Changed components
src/init.cppsrc/script/sigcache.cppRange proof validation cacheInspect captured patch +13 / −5
### src/init.cpp
@@ -636,6 +636,7 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
argsman.AddArg("-capturemessages", "Capture all P2P messages to disk", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-mocktime=<n>", "Replace actual time with " + UNIX_EPOCH_TIME + " (default: 0)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-maxsigcachesize=<n>", strprintf("Limit sum of signature cache and script execution cache sizes to <n> MiB (default: %u)", DEFAULT_VALIDATION_CACHE_BYTES >> 20), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
+ argsman.AddArg("-rangeproofcache", strprintf("Enable the range proof validation cache (default: %u). Use -norangeproofcache to disable.", 1), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-maxtipage=<n>",
strprintf("Maximum tip age in seconds to consider node in initial block download (default: %u)",
Ticks<std::chrono::seconds>(DEFAULT_MAX_TIP_AGE)),
### src/script/sigcache.cpp
@@ -5,6 +5,7 @@
#include <script/sigcache.h>
+#include <common/args.h>
#include <crypto/sha256.h>
#include <hash.h>
#include <logging.h>
@@ -134,6 +135,10 @@ namespace {
// To be called once in AppInit2/TestingSetup to initialize the rangeproof cache
bool InitRangeproofCache(size_t max_size_bytes)
{
+ if (!gArgs.GetBoolArg("-rangeproofcache", true)) {
+ LogPrintf("Range proof cache disabled via -norangeproofcache\n");
+ return true;
+ }
auto setup_results = rangeProofCache.setup_bytes(max_size_bytes);
if (!setup_results) return false;
const auto [num_elems, approx_size_bytes] = *setup_results;
@@ -161,10 +166,12 @@ bool CachingRangeProofChecker::VerifyRangeProof(const std::vector<unsigned char>
// argument risks returning a cached positive result for a proof that was
// verified with different inputs.
uint256 entry;
- rangeProofCache.ComputeEntryRangeProof(entry, vchRangeProof, vchValueCommitment, vchAssetCommitment, scriptPubKey);
-
- if (rangeProofCache.Get(entry, !store)) {
- return true;
+ const bool useCache = gArgs.GetBoolArg("-rangeproofcache", true);
+ if (useCache) {
+ rangeProofCache.ComputeEntryRangeProof(entry, vchRangeProof, vchValueCommitment, vchAssetCommitment, scriptPubKey);
+ if (rangeProofCache.Get(entry, !store)) {
+ return true;
+ }
}
if (vchRangeProof.size() == 0) {
@@ -193,7 +200,7 @@ bool CachingRangeProofChecker::VerifyRangeProof(const std::vector<unsigned char>
return false;
}
- if (store) {
+ if (useCache && store) {
rangeProofCache.Set(entry);
}
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.