test(chat): regtest harness verifying on-chain memo round-trip (larger messages + Control)

Adds a dev-only harness that closes the "needs a live daemon" gap for the new
chat wire paths, fund-safely on an isolated regtest chain:
- tools/chat_regtest_smoke.cpp (+ an EXCLUDE_FROM_ALL CMake target): a small
  driver linking the chat library — derive identity / compose a message or a
  Control memo / extract + decrypt harvested memos. Secret-safe.
- tools/chat_regtest.py: starts a throwaway regtest dragonxd (own datadir,
  -regtest, no network — nothing touches ~/.hush), funds a shielded note, then
  drives a full round-trip through the real daemon: compose -> z_sendmany the
  memo outputs -> mine -> z_listreceivedbyaddress -> feed back to the driver.

Verified on dragonxd v1.3.0: a chunked 1529-byte message (8 memo outputs in one
tx) and a self-addressed Control(del) memo both round-trip verbatim and
reassemble/extract correctly — i.e. the real node accepts a multi-output 0-value
chat tx and returns its memos intact. Paths are env-overridable
(DRAGONX_REGTEST_DAEMON_DIR / DRAGONX_CHAT_SMOKE / DRAGONX_REGTEST_RUN).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 14:03:45 -05:00
co-authored by Claude Opus 4.8
parent 2d63a72098
commit 63c284684c
3 changed files with 309 additions and 0 deletions
+20
View File
@@ -995,6 +995,26 @@ target_compile_definitions(HushChatFixtureCheck PRIVATE
DRAGONX_ENABLE_CHAT=0
)
# Regtest chat smoke driver (dev tool; never shipped). Links the real chat library so a runner
# script can verify a chunked message + Control memo round-trip through a live regtest dragonxd.
# cmake --build build/linux --target chat_regtest_smoke
add_executable(chat_regtest_smoke EXCLUDE_FROM_ALL
tools/chat_regtest_smoke.cpp
src/chat/chat_crypto.cpp
src/chat/chat_identity.cpp
src/chat/chat_outgoing.cpp
src/chat/chat_protocol.cpp
)
target_include_directories(chat_regtest_smoke PRIVATE
${CMAKE_SOURCE_DIR}/src
${SODIUM_INCLUDE_DIR}
)
target_link_libraries(chat_regtest_smoke PRIVATE
nlohmann_json::nlohmann_json
${SODIUM_LIBRARY}
)
target_compile_definitions(chat_regtest_smoke PRIVATE DRAGONX_ENABLE_CHAT=1)
# -----------------------------------------------------------------------------
# Copy resources
# -----------------------------------------------------------------------------