refactor(audit): batch 2 — remove dead scaffolding from the shipping binary
Two dead-code removals surfaced by the audit; no runtime behavior change.
1. Delete the lite-lifecycle "readiness" scaffold (~1,586 lines). The pure
dry-run evaluateLiteWalletServerLifecycleReadiness (whose own status text
says "wallet lifecycle execution is still disabled in this scaffold") had
zero callers; executeLiteWalletServerSelectionUi had zero callers; and
executeLiteWalletLifecycleUiRequest's only caller was a fallback in
settings_page reached only when app->liteWallet() is null. Deleted
lite_wallet_server_lifecycle_readiness.{h,cpp} and the readiness /
UI-execution machinery + enums + translation tables from both adapters,
keeping the genuinely-live helpers (liteConnectionSettingsFromAppSettings,
applyLiteConnectionSettingsToAppSettings, redactLiteServerSelectionValue,
and the LiteWalletLifecycleUiExecutionInput DTO the live create/open/
restore path still uses). The null-backend fallback now sets a plain
"Lite wallet backend unavailable" status. This is exactly the
readiness/scaffold pattern CLAUDE.md forbids regrowing.
2. Split the HushChat fixture/capture-manifest/seed-projection tooling
(~2,050 lines, incl. the libsodium seed-projection) out of
chat_protocol.cpp (1854 -> 284) and chat_protocol.h (586 -> 105) into a
new chat_fixture_tooling.{h,cpp} compiled ONLY into the HushChatFixtureCheck
dev tool — never into the app, lite, or test binaries (verified via nm).
The app keeps only the runtime slice (memo parsing + tx metadata
extraction) that network_refresh_service actually calls. Also moved the
decrypt-preflight/hex helpers, which likewise had no runtime caller.
Note: the HushChat split is on gated-off experimental code and should be
coordinated with the pending dormant-HushChat-content handling (commit
af06b8b) before the lite PR — done here as a pure mechanical split, no redesign.
Full-node + Lite + HushChatFixtureCheck build clean; ctest 1/1; hygiene clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,150 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "lite_connection_service.h"
|
||||
#include "lite_wallet_server_lifecycle_readiness.h"
|
||||
#include "wallet_capabilities.h"
|
||||
|
||||
#include "../config/settings.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace dragonx {
|
||||
namespace wallet {
|
||||
|
||||
enum class LiteWalletServerSelectionUiExecutionStatus {
|
||||
ReadyForFutureLifecycle,
|
||||
WaitingForLiteBuild,
|
||||
WaitingForBackendCapability,
|
||||
WaitingForSettings,
|
||||
WaitingForServerSelection,
|
||||
WaitingForPersistenceOwner,
|
||||
WaitingForDisplayStatus,
|
||||
WaitingForLifecycleUi,
|
||||
WaitingForPrivateDataRedaction,
|
||||
WaitingForSyncPlannerFeed,
|
||||
SettingsSaveFailed,
|
||||
RuntimeExecutionDisabled
|
||||
};
|
||||
|
||||
enum class LiteWalletServerSelectionUiExecutionIssue {
|
||||
FullNodeBuild,
|
||||
LiteBackendCapabilityMissing,
|
||||
SettingsNotLoaded,
|
||||
ServerSelectionMissing,
|
||||
ServerPersistenceOwnerMissing,
|
||||
SelectedServerDisplayMissing,
|
||||
LifecycleUiOwnerMissing,
|
||||
PrivateDataRedactionMissing,
|
||||
SyncPlannerFeedMissing,
|
||||
SettingsSaveFailed,
|
||||
ServerConnectivityCheckRequested,
|
||||
WalletLifecycleExecutionRequested,
|
||||
SyncRequested,
|
||||
SyncStatusPollingRequested,
|
||||
WorkerQueueRequested,
|
||||
WalletStateMutationRequested,
|
||||
WalletFilePersistenceRequested,
|
||||
SendImportExportRequested
|
||||
};
|
||||
|
||||
struct LiteWalletServerSelectionUiIntent {
|
||||
bool selectedServerIntentProvided = false;
|
||||
LiteServerSelectionMode selectionMode = LiteServerSelectionMode::Sticky;
|
||||
std::string selectedServerUrl;
|
||||
std::size_t randomSelectionSeed = 0;
|
||||
std::string chainName;
|
||||
bool replaceServers = false;
|
||||
std::vector<LiteServerEndpoint> servers;
|
||||
};
|
||||
|
||||
struct LiteWalletServerSelectionPersistenceExecutionInput {
|
||||
bool settingsLoaded = true;
|
||||
bool havePersistedSelectionIntent = true;
|
||||
bool persistSelectedServer = true;
|
||||
bool persistenceOwnerReady = true;
|
||||
bool writeSettings = false;
|
||||
std::string settingsSavePath;
|
||||
};
|
||||
|
||||
struct LiteWalletServerSelectionUiExecutionInput {
|
||||
WalletCapabilities capabilities;
|
||||
LiteWalletServerSelectionUiIntent intent;
|
||||
LiteWalletServerSelectionPersistenceExecutionInput persistence;
|
||||
LiteWalletLifecycleUiPrerequisites ui;
|
||||
LiteWalletLifecycleOperation operation = LiteWalletLifecycleOperation::CreateNew;
|
||||
LiteWalletCreateRequest createRequest;
|
||||
LiteWalletOpenRequest openRequest;
|
||||
LiteWalletRestoreRequest restoreRequest;
|
||||
bool requireLifecycleReadiness = false;
|
||||
|
||||
bool serverConnectivityCheckRequested = false;
|
||||
bool walletExistsCheckRequested = false;
|
||||
bool walletLifecycleExecutionRequested = false;
|
||||
bool syncStartRequested = false;
|
||||
bool syncStatusPollingRequested = false;
|
||||
bool workerQueueEnqueueRequested = false;
|
||||
bool walletStateMutationRequested = false;
|
||||
bool walletFilePersistenceRequested = false;
|
||||
bool sendImportExportExecutionRequested = false;
|
||||
};
|
||||
|
||||
struct LiteWalletServerSelectionUiExecutionIssueInfo {
|
||||
LiteWalletServerSelectionUiExecutionIssue issue = LiteWalletServerSelectionUiExecutionIssue::SettingsNotLoaded;
|
||||
std::string message;
|
||||
};
|
||||
|
||||
struct LiteWalletServerSelectionUiExecutionResult {
|
||||
bool ok = false;
|
||||
bool dryRunOnly = true;
|
||||
bool noNetwork = true;
|
||||
bool noBridgeCalls = true;
|
||||
bool noServerHealthChecked = true;
|
||||
bool noWalletExistsChecked = true;
|
||||
bool noWalletCreated = true;
|
||||
bool noWalletOpened = true;
|
||||
bool noWalletRestored = true;
|
||||
bool noSyncStarted = true;
|
||||
bool noSyncStatusPolled = true;
|
||||
bool noWalletPersistence = true;
|
||||
bool noSendImportExportExecution = true;
|
||||
bool workerQueueEnqueued = false;
|
||||
bool stateMutationAllowed = false;
|
||||
bool stateMutated = false;
|
||||
bool walletStateWritten = false;
|
||||
bool settingsMutationAllowed = true;
|
||||
bool settingsMutated = false;
|
||||
bool noSettingsPersistence = true;
|
||||
bool settingsWritten = false;
|
||||
bool settingsPersistenceAccepted = false;
|
||||
bool selectedServerIntentAccepted = false;
|
||||
bool lifecycleReadinessAccepted = false;
|
||||
bool lifecycleReportCouldFeedSyncPlanners = false;
|
||||
bool selectedServerRedacted = false;
|
||||
LiteWalletServerSelectionUiExecutionStatus status = LiteWalletServerSelectionUiExecutionStatus::WaitingForSettings;
|
||||
std::string error;
|
||||
std::string selectedServerUrlRedacted;
|
||||
std::string diagnosticSummary;
|
||||
LiteConnectionSettings connectionSettings;
|
||||
LiteServerSelectionResult selectedServer;
|
||||
LiteWalletServerLifecycleReadinessInput lifecycleInput;
|
||||
LiteWalletServerLifecycleReadinessResult lifecycleReadiness;
|
||||
std::vector<LiteWalletServerSelectionUiExecutionIssueInfo> issues;
|
||||
};
|
||||
|
||||
LiteConnectionSettings liteConnectionSettingsFromAppSettings(const config::Settings& settings);
|
||||
void applyLiteConnectionSettingsToAppSettings(config::Settings& settings,
|
||||
const LiteConnectionSettings& connectionSettings);
|
||||
const char* liteWalletServerSelectionUiExecutionStatusName(
|
||||
LiteWalletServerSelectionUiExecutionStatus status);
|
||||
const char* liteWalletServerSelectionUiExecutionIssueName(
|
||||
LiteWalletServerSelectionUiExecutionIssue issue);
|
||||
std::string redactLiteServerSelectionValue(const std::string& value);
|
||||
|
||||
LiteWalletServerSelectionUiExecutionResult executeLiteWalletServerSelectionUi(
|
||||
config::Settings& settings,
|
||||
const LiteWalletServerSelectionUiExecutionInput& input);
|
||||
|
||||
} // namespace wallet
|
||||
} // namespace dragonx
|
||||
} // namespace dragonx
|
||||
|
||||
Reference in New Issue
Block a user