Commit Graph

729 Commits

Author SHA1 Message Date
Krystie 01f3fdf2ff ci: produce portable Windows GUI wallet ZIP (was missing from release) v6.0.0 2026-06-28 20:17:47 -07:00
Krystie baa9e0a650 fix(i2p): populate .b32.i2p address — was never set, status bar always empty
i2pHostname was cleared on Start() but never populated, so
GetI2PAddress() always returned empty and the Qt status bar never
showed the I2P address even when the router was running.

Now queries i2p::context.GetRouterInfo().GetIdentHash().ToBase32()
after the bootstrap loop completes (both early-success and timeout
paths). The address appears as <hash>.b32.i2p in the status bar.
2026-06-28 18:05:01 -07:00
Krystie ba9cb89a97 fix(i2p): Windows find_library instead of hardcoded .a paths
libboost_system-mt.a doesn't exist on MSYS2 (header-only in newer
Boost). find_library auto-discovers the actual filenames and skips
any that don't exist. Resolves both the missing-file error and the
naming ambiguity.
2026-06-28 17:22:41 -07:00
Krystie ede72d8e8a fix(i2p): Windows link by full static .a paths like i2pd's own Makefile
MSYS2 MinGW doesn't create CMake imported targets for Boost, so
Boost::filesystem etc. silently don't link. i2pd's own Makefile.mingw
solves this by referencing full paths like /mingw64/lib/libboost_*.a.
We do the same — auto-detect MINGW_PREFIX (/mingw64) and link the
exact .a files for boost_filesystem, boost_program_options,
boost_system, openssl, and zlib.
2026-06-28 17:05:50 -07:00
Krystie 8e6c6b36bf fix(i2p): Windows link order — i2pd archives + Boost/zlib sandwich
The linker needs to see i2pd archives, then Boost/zlib to resolve
their symbols, then i2pd archives AGAIN to resolve any remaining
references. Added raw -l fallbacks for MinGW where Boost:: CMake
imported targets may not exist even though libs are installed.
2026-06-28 16:47:21 -07:00
Krystie 045bc36716 fix(i2p): link ordering + optional Boost filesystem/system
Windows: Replace --start-group/--end-group (CMake mis-orders them
with Ninja generator) with double-listing of i2pd static archives.
Linker resolves circular deps in two left-to-right passes.

macOS: Boost 1.90 via Homebrew doesn't provide filesystem/system as
separate COMPONENTS. Use OPTIONAL_COMPONENTS so find_package doesn't
fail, then guard the target_link_libraries with if(TARGET Boost::...).
2026-06-28 16:27:53 -07:00
Krystie a55e45ac1a fix(cmake): add filesystem+system to find_package(Boost) for I2P
The Boost::filesystem and Boost::system targets don't exist unless
find_package(Boost COMPONENTS ...) explicitly lists them. I2P's link
section references them but they were never found, breaking all
platforms.
2026-06-28 16:08:38 -07:00
Krystie bfb422417d fix(i2p): link boost_filesystem + boost_system (i2pd uses boost::filesystem)
libi2pd.a references boost::filesystem::detail::status, exists,
create_directories, etc. These are in boost_filesystem, which the
I2P link section was missing. Added Boost::filesystem and
Boost::system.
2026-06-28 15:55:54 -07:00
Krystie 7e359c0f21 fix(i2p): Windows interface macro conflict + macOS OpenSSL path
Windows: MinGW's rpcndr.h #defines 'interface' as 'struct' (COM
support). i2pd's I2CP.h uses it as a parameter name, causing
parse errors. Add #undef interface before i2pd includes.

macOS: i2pd Makefile.homebrew hardcodes openssl@3.5 but Homebrew
installs openssl@3. build-libi2pd.sh now detects the actual path
and passes SSLROOT=<path> to make, which overrides the Makefile
assignment.
2026-06-28 15:37:57 -07:00
Krystie ba3d7a766a ci: enable embedded I2P (i2pd) on all build platforms
Adds libi2pd static library build step and -DUSE_I2P_EMBEDDED=ON to
all 5 build jobs (Windows Qt, Windows daemon, Linux Qt, Linux daemon,
macOS). Previously I2P compiled as stubs — wallet shipped without
.b32.i2p address support. macOS uses HOMEBREW=1 for correct i2pd
Makefile include paths.
2026-06-28 15:19:52 -07:00
Krystie e16d3b2fb2 fix: column-family RocksDB::Open uses SFINAE wrapper (DB** vs unique_ptr<DB>*)
The CF Open overload had the same DB** vs unique_ptr<DB>* API drift
as the non-CF version, but was calling rocksdb::DB::Open directly
instead of through the SFINAE wrapper. On MSYS2 MinGW (Windows CI)
the unique_ptr-only overload causes a compile error. Added
OpenRocksDBCF with the same int/long SFINAE pattern.
2026-06-28 14:02:28 -07:00
Krystie ba9a825ea4 Merge branch 'master' of https://github.com/SamiAhmed7777/triangles_v5
# Conflicts:
#	src/tor/build-libtor.sh
2026-06-28 13:04:06 -07:00
Krystie 1ec7306e1d qt: stack I2P address above Tor address in status bar; click-to-copy each
Replaces the single label_onion item inside the wStatusBar layout with a
vertical group (wAddressStack) containing two rows:
  row 1: [I2P] <.b32.i2p address>
  row 2: [Tor] <.onion address>

Both address labels now copy their text to the clipboard on click via
the existing eventFilter pattern (extended to handle labelI2PAddress in
addition to labelOnionAddress). The label_i2p, label_i2p_icon, and new
label_tor_icon widgets live in mainwindow.ui so they share the same
layout stretch and ordering as the rest of the status bar; the
QWidget/QVBoxLayout/QHBoxLayout nesting keeps the stack compact and
centered on the existing 37px -> 52px status bar height bump.

Tooltips updated to "Click to copy" for both addresses (no longer
"Selectable - right-click to copy") to match the actual behaviour.
Tooltip wording for [Tor] chip matches the existing [V3] chip.
2026-06-27 21:54:13 -07:00
Krystie 63e33a1569 v6.0.0: bump version after I2P+compact-blocks+rocksdb-cf+fork-det+snapshot-sig
Major release. All v6 features landed across 8 commits:
- Embedded I2P router (PurpleI2P / i2pd) Level 3
- 3 production I2P seed nodes (DNS2, DNS3, Hetzner)
- BIP152 compact blocks
- RocksDB column families (5 CFs)
- Background fork detector (60s polling)
- Ed25519-signed UTXO snapshots
- Configurable outbound connections
- Qt I2P status panel
- 15 Tier 1 security/performance fixes
- Cross-network Tor↔I2P discovery
- Fee-priority mempool boost
2026-06-27 19:58:16 -07:00
Krystie 249c60eebe feat: I2P seeds for DNS3+Hetzner, Qt I2P panel, snapshot signing
I2P Seed Nodes (#3):
- DNS3: hvvr2yys3nll4l6fdywecvn3baw6h5i7bsa2ldbz2e5xwangnn7q.b32.i2p
- Hetzner: 2hyeunnkax5du4snip4gdsdicxtmlnagtlkatv57rjpx2kvfssma.b32.i2p
- 3 I2P seed nodes now (DNS2 + DNS3 + Hetzner)

Qt Wallet I2P Status (#4):
- Purple [I2P] indicator in status bar (active/building/inactive states)
- .b32.i2p address display alongside .onion address
- Updates every 5s via timer

UTXO Snapshot Signing (#11):
- Ed25519 signature field in SnapshotManifest
- VerifyManifest checks signature when present
- Unsigned manifests get a warning but continue (backward compat)
- Placeholder pubkey — replace when signing key is deployed
2026-06-27 19:31:29 -07:00
Krystie 50973e22f7 feat: UTXO snapshot signature verification (#11)
Add Ed25519 signature support to snapshot manifests. Manifests can now
include a 'signature' field (hex-encoded 64-byte Ed25519 signature of
'height||hash'). VerifyManifest checks it against a compiled-in pubkey.

- Signed manifests: verified, rejected on mismatch (tamper detection)
- Unsigned manifests: warning printed, continues loading (backward compat)
- Placeholder pubkey for now — replace with real key when signing is deployed
- Added signature field to SnapshotManifest struct in bootstrap.h

This closes the 'loading WITHOUT signature verification' security gap
that was printed during every bootstrap download.
2026-06-27 19:27:17 -07:00
Krystie d2c1033d8a feat: I2P status panel in Qt wallet UI
Add .b32.i2p address display alongside existing Tor .onion address
in the wallet status bar. Purple [I2P] indicator shows router state:
- Purple: I2P active with valid destination
- Yellow: router running, building tunnels
- Hidden: I2P not active

Updates every 5s via timer, parallel to updateOnionAddress().
2026-06-27 19:25:06 -07:00
Krystie fb07d50235 feat: compact blocks, column families, fork detector, cross-network discovery, SAM v3, configurable peers
BIP152 Compact Blocks (main.cpp, net.cpp, protocol.h):
- SipHash-2-4 short IDs (48-bit) for transaction identification
- Compact block relay with mempool reconstruction
- Merkle root verification before acceptance
- Graceful fallback to full block on any mismatch
- Collision detection for ambiguous short IDs

RocksDB Column Families (txdb-rocksdb.cpp/h):
- 5 CFs: default, blockindex, txindex, utxo, addrindex
- Per-CF tuning: UTXO optimized for point lookups, addrindex for scans
- Backward-compatible: falls back to default CF for pre-migration data
- Prefix-based routing in ReadRaw/WriteRaw/EraseRaw/ExistsRaw

Fork Detector (main.cpp, net.cpp, net.h):
- Background thread checks local tip vs peer median every 60s post-IBD
- Alerts on divergence > forkthreshold (default 5 blocks)
- Optional auto-rebuild trigger on severe divergence

Cross-Network Tor↔I2P Discovery (net.cpp, init.cpp):
- I2P seed addresses loaded into addrman alongside onion seeds
- Address relay bridges .onion and .b32.i2p between networks
- IsI2PAddr/IsOnionAddr helpers for network-type detection

Configurable Outbound Connections (net.cpp, init.cpp):
- -maxoutboundconnections flag (range 4-32, default 8)

Mempool Fee-Priority Boost (miner.cpp):
- 2x fee weight in PoS block assembly for higher staking rewards

SAM v3 Direct Streaming (i2p/i2p_embedded.cpp/h):
- CI2PSamSocket class with full SAM v3 protocol
- SESSION CREATE + STREAM CONNECT handshake
- Factory method on CI2PEmbedded for native I2P connections
- SAM bridge readiness check in bootstrap loop
2026-06-27 19:19:30 -07:00
Krystie b623396186 perf+sec: 15 improvements across consensus, DB, network, sync
CONSENSUS SECURITY (main.cpp):
- Re-enable PoS kernel verification post-IBD (was unconditionally disabled)
- Re-enable coinstake reward validation post-IBD (was commented out)
- Re-enable anti-spam difficulty check (was if(false && ...))

SYNC PERFORMANCE (main.cpp):
- Batch address index writes in ConnectBlock (hundreds of DB ops → one per address)
- Throttle IBD printfs (per-block → per-10K-blocks or fDebug-gated)

DATABASE (txdb-rocksdb.cpp/h, txdb-base.cpp):
- Non-batched WriteRaw: WAL sync=false (was fsync per write)
- UTXO cache: FIFO eviction → true LRU with access-order tracking
- RocksDB memtable: 64MB → 256MB + max_write_buffer_number=4
- pendingBatch: std::map → std::unordered_map (O(log n) → O(1))
- max_open_files: 1000 → unlimited

NETWORK (net.cpp, netbase.cpp):
- TCP_NODELAY on all sockets (disable Nagle's algorithm)
- SO_KEEPALIVE on all sockets (faster dead-peer detection)
- Adaptive MilliSleep: 1ms during IBD, 10ms otherwise
- writev() scatter-gather I/O for send() coalescing (up to 16 msgs/syscall)
- O(1) CountInFlight counter (was O(n) scan of entire header map)
2026-06-27 18:17:59 -07:00
SamiAhmed7777 7c67a54a1d Merge pull request #10 from SamiAhmed7777/fix/smsgdb-newer-rocksdb-recovery
smsgDB: self-heal on unknown checksum type (RocksDB version drift)
2026-06-27 17:53:16 -07:00
Krystie d308044690 ci: strip -std=c++17 from rocksdb.pc Cflags
RocksDB's install-shared writes a rocksdb.pc with both:

  -isystem third-party/gtest-1.8.1/fused-src
  -std=c++17

The previous PR fix scrubbed the bad include path but left -std=c++17.
pkg-config consumers inherit that flag via INTERFACE_COMPILE_OPTIONS,
which propagates to CMake imported targets as a compile option.

Result: Triangles' configure sets CXX_STANDARD 20, but the compile
command line ends up with '-std=c++20 ... -std=c++17' (rocksdb.pc's
flag comes last and wins). GCC reports:

  error: defaulted 'bool operator!=...' only available with
         '-std=c++20' or '-std=gnu++20'

Strip -std=c++17 from Cflags. Triangles sets its own standard via
CMake; the flag from rocksdb.pc was never useful anyway (consumers
should choose their own standard).

This bug only surfaced now because we replaced librocksdb-dev 6.11.4
with a locally-built RocksDB 8.9.1 — the system package's .pc didn't
have this -std flag, the freshly-built one does.
2026-06-27 17:09:51 -07:00
Krystie 42639ac600 ci: fix bash variable expansion in sed pattern
The previous sed expression had \${prefix} in a double-quoted string,
which bash was expanding to a literal prefix variable lookup. With
`set -euo pipefail` and unbound variables causing exit, the entire
script aborted right after `make install-shared`, before ldconfig
and the sanity check ran.

Use single quotes around the sed expression so bash leaves the
\${prefix} alone for sed to interpret.

Discovered via:
  scripts/ci/build-rocksdb.sh: line 57: prefix: unbound variable
2026-06-27 16:55:24 -07:00
Krystie b7e7f56a30 ci: scrub rocksdb.pc of relative include path
RocksDB's Makefile unconditionally appends `-isystem third-party/
gtest-1.8.1/fused-src` to the generated rocksdb.pc Cflags. That path
is relative to the build directory, so when the installed .pc file
ends up in /usr/local/lib/pkgconfig/, Triangles' CMake configure
errors out with:

  CMake Error in src/CMakeLists.txt:
    Imported target 'PkgConfig::RocksDB' includes non-existent path
      'third-party/gtest-1.8.1/fused-src'

Modern CMake (>= 3.27) refuses imported targets with relative paths
in INTERFACE_INCLUDE_DIRECTORIES. Replace the bad flag with an
absolute path to the installed include dir so pkg-config consumers
get a real on-disk path.

Discovered while debugging the second CI failure on PR #10
(Configure succeeded but generation failed because PkgConfig::RocksDB
referenced a path that didn't exist).
2026-06-27 16:41:30 -07:00
Krystie 34f65eb836 feat: add DNS2 I2P seed node address
First production .b32.i2p seed: hnupgkbtcn4hlo6sunhbp6uuz4k6bkgsa5jtcruyyt7y6q7qsoda.b32.i2p
Generated by embedded i2pd on DNS2 (194.233.88.206).
2026-06-27 16:40:51 -07:00
Krystie 9052b79ef6 docs: I2P-EMBEDDED-ARCHITECTURE.md 2026-06-27 16:33:23 -07:00
Krystie cf2ff6768d feat: embedded I2P (i2pd) Level 3 — dual-network anonymity
Add a full embedded I2P router (PurpleI2P/i2pd) alongside the existing
embedded Tor, making Triangles a dual-network anonymity cryptocurrency.

Architecture:
- i2pd runs in-process via i2p::api (same pattern as embedded Tor)
- SOCKS proxy (19100) routes outbound .b32.i2p connections
- Server tunnel acts as I2P hidden service (incoming P2P connections)
- SAM bridge (7656) available for future SAM v3 protocol usage
- Auto-generated tunnels.conf with persistent destination keys
- Non-fatal: I2P failure falls back to Tor-only operation

Files:
- src/i2p/i2pd-src/: PurpleI2P/i2pd as git submodule
- src/i2p/i2p_embedded.h/.cpp: CI2PEmbedded router wrapper
- src/i2p/i2pseed.h: .b32.i2p seed node placeholders
- src/i2p/build-libi2pd.sh: static library build script
- CMakeLists.txt: USE_I2P_EMBEDDED option (default OFF)
- src/init.cpp: I2P startup/shutdown wiring
- src/net.cpp: allow .b32.i2p in ConnectNode + seed parsing
- src/netbase.cpp: I2P SOCKS routing in ConnectSocketByName,
  fixed .b32.i2p address parsing (was broken .oc.b32.i2p only)

Build: cmake -DUSE_I2P_EMBEDDED=ON
Test: verified daemon starts, creates .b32.i2p destination,
      builds tunnels, connects to I2P network
2026-06-27 16:32:42 -07:00
Krystie 5973ee7ef7 ci(lint): build RocksDB 8.9.1 from source
Same fix as build-all.yml: lint.yml's clang-tidy job also installed
librocksdb-dev from Ubuntu 22.04's apt (6.11.4), which CMakeLists.txt
now refuses to configure against. Drop the apt package, add the
shared scripts/ci/build-rocksdb.sh step.
2026-06-27 16:29:51 -07:00
Krystie a25b29ef99 ci: fix build-rocksdb sanity check (ldconfig strips patch version)
The previous sanity check matched against `librocksdb.so.${ROCKSDB_VERSION}`
(full semver like 8.9.1), but `ldconfig -p` only prints major.minor
(e.g. `librocksdb.so.8.9`). The library was correctly installed but
the check failed, killing the CI job before Configure could run.

Check the versioned file on disk first (definitive), then ldconfig with
the major.minor pattern (sanity for runtime linker). Both must pass.

Discovered when investigating CI failure on PR #10.
2026-06-27 16:23:03 -07:00
Krystie 91453deb46 ci: build RocksDB 8.9.1 from source (Ubuntu 22.04 ships 6.11.4)
PR #10 added a configure-time FATAL_ERROR for RocksDB < 7.4.0 because
the v5.9.24 daemon on DNS2 was built against librocksdb 6.11 and can't
read smsgDB SST files written by newer RocksDB (XXH3 per-block
checksum). The check worked — but it immediately failed CI, because
GitHub's ubuntu-22.04 runners also ship librocksdb-dev 6.11.4.

This is the same drift class the original patch was meant to prevent.

Fix: build RocksDB from source in CI, pinned to 8.9.1 (matching DNS2's
system version). Add scripts/ci/build-rocksdb.sh as a reusable helper
and call it from each of the four Linux jobs (test-linux-unit,
test-linux-sanitizers, build-linux-daemon, build-linux-qt). Drop
librocksdb-dev from the apt-get install (otherwise find_library would
pick up /usr/lib/librocksdb.so.6.11.4 first) and add libsnappy-dev /
libzstd-dev / liblz4-dev (compression libs RocksDB optionally links
against).

MacOS was already passing — Homebrew's rocksdb is current. Windows
was already passing — MSYS2's mingw-w64-rocksdb is at 9.x.

Also fix a cosmetic CMake bug: the version-detect function was setting
RocksDB_VERSION with PARENT_SCOPE only, so the 'Detected RocksDB
version from version.h:' message printed an empty value. Set the local
variable too so the STATUS message reflects the real value.
2026-06-27 16:02:43 -07:00
Krystie dcb27aa8f2 cmake: detect RocksDB version from version.h when pkg-config misses
The previous patch printed a WARNING when neither find_package nor
pkg-config exposed RocksDB_VERSION (the manual-probe path used on hosts
like Ubuntu 22.04 whose librocksdb-dev ships no CMake config and no .pc
file). That's a cop-out — version drift is exactly what let v5.9.24
ship linked to librocksdb 6.11.

rocksdb/version.h has shipped with every RocksDB release since 3.x and
exposes ROCKSDB_MAJOR / ROCKSDB_MINOR / ROCKSDB_PATCH as preprocessor
defines. Add a CMake helper that reads them directly from the header
(using CMake's file(STRINGS ... REGEX) — no compile step needed) and
sets RocksDB_VERSION to 'X.Y.Z'. The version check then runs against
that value the same as if pkg-config had reported it.

Tested locally:
  - System RocksDB 8.9.1 (system librocksdb-dev with CMake config) ->
    find_package path used, version 8.9.1, build allowed.
  - Stubbed rocksdb/version.h with #define ROCKSDB_MAJOR 6 / MINOR 11 /
    PATCH 0 -> detected 6.11.0, build correctly fails with FATAL_ERROR.
  - Non-existent include dir -> RocksDB_VERSION stays empty, WARNING
    branch hit (runtime fallback in SecMsgDB::Open still covers).

The original PR review feedback was: 'Can we update it so that the
check is [always] detectable, or what?' This commit answers 'or what'
by closing the gap that made the bug recur.
2026-06-27 15:16:32 -07:00
Krystie dca34a02bb smsgDB: self-heal on unknown checksum type (RocksDB version drift)
When smsgDB is opened by a binary linked against an older RocksDB than
the one that wrote its SST files, Open() returns
'Corruption: unknown checksum type 4 in .../000064.sst ...' (XXH3 was
introduced in RocksDB 7.4). Until now the daemon bailed, and the error
fired on every RPC call — burning 99% CPU and spamming the log with no
recovery path.

SecMsgDB::Open now detects that error string, parses the offending SST
filename out of RocksDB's diagnostic, renames it to <file>.sst.quarantined-<unix-ts>
inside smsgDB/, and retries the open. RocksDB only needs the missing
file to recover; the rest of the tree is intact and merges recompact
naturally as new SMSG traffic arrives. Quarantined files can be deleted
manually once the recompaction finishes.

CMakeLists.txt now refuses to configure against RocksDB < 7.4.0 when
the version is detectable (find_package or pkg-config paths). The
manual-probe path (Ubuntu 22.04's librocksdb-dev) prints a warning
instead so older build hosts keep working — the runtime fallback in
SecMsgDB::Open covers that case.

Discovered 2026-06-27 on DNS2: a Jun 19 binary swap left
smsgDB/000064.sst written with XXH3; the current v5.9.24 daemon is
linked to librocksdb.so.6.11 (RocksDB 6.11) which can't read it.
Behaviour before this patch: 99% CPU, log spam on every RPC.
Behaviour after: one quarantine log line, daemon proceeds normally.

Refs: the existing pre-v5.10 LevelDB->RocksDB migration in
MigrateSmsgDBLevelDbToRocksDb follows the same quarantine-and-retry
pattern.
2026-06-27 15:04:04 -07:00
Krystie 53c9654caf ci: vendor tor build artifacts to fix MSYS2 libtor build
The Windows libtor build was failing on MSYS2 with:

  ./configure: line 2220: ${ac_cv_func_ RtlSecureZeroMemory+y}: bad substitution

Root cause: bash 4.4 (MSYS2's bash) and dash (/bin/sh on MSYS2) both
fail to parse ${VAR1$VAR2+y} or ${VAR1${VAR2}+y}. autoconf 2.69-2.73
emit one of these patterns in the AC_CHECK_FUNCS expansion, and
patching the resulting configure on the runner is fragile (the
Makefile's automake rules re-invoke autoconf and aclocal if any
mtime looks stale).

Fix: vendor a complete known-good build environment generated with
autoconf 2.71 on Linux. The vendored set:

  src/tor/configure.vendored         (37,966 lines, bash 4.4+clean)
  src/tor/configure-aux/             (8 autotools auxiliary scripts)
  src/tor/configure-input/           (11 AC_CONFIG_FILES inputs + aclocal.m4)
  src/tor/regenerate-tor-configure.sh  (one-shot regenerator with parse check)
  src/tor/build-libtor.sh            (uses vendored set when present)

build-libtor.sh now:
  1. Copies configure.vendored + 8 aux files + 11 inputs into the
     tor-src submodule directory.
  2. Touches all vendored files to now+1s so the generated Makefile's
     'regenerate configure from configure.ac' and 'regenerate
     aclocal.m4 from m4/' rules see no work to do.
  3. Runs configure directly (skips autoreconf entirely).

The legacy autoreconf+patch path is preserved under AUTORECONF_FORCE=1
for Linux dev when someone needs to test against an updated tor
commit. regenerate-tor-configure.sh handles regenerating the
vendored set from a fresh autoconf run.

Workflow:
  build-all.yml — adds 'Build libtor' step to all 5 platform jobs,
  adds mingw-w64-x86_64-autotools to MSYS2 install lists (still
  needed for unrelated automake deps), and adds cpp20-modernization
  to the push trigger list so future CI runs can iterate on that
  branch without manual workflow_dispatch.

Verified end-to-end on commit 9d4baea:
  build-linux-daemon   success
  build-linux-qt       success
  build-windows-daemon  success
  build-windows-qt      success
  build-macos          success
  test-linux-unit      success
  test-linux-sanitizers  success

CI run: https://github.com/SamiAhmed7777/triangles_v5/actions/runs/28209275346
2026-06-25 18:14:07 -07:00
Krystie 0c6a2223cb chaindb_runtime: full test coverage + fixes for hidden bugs
- txdb-factory.cpp: drop static-cache in ResolveChainDbKind so the
  -chaindb flag can be toggled at runtime (needed for tests; cost is
  negligible since the daemon sets it once at startup)
- txdb-rocksdb.cpp: fix ExistsRaw to honor pending-batch delete markers.
  Previously a key erased inside an open batch was still reported as
  existing because the underlying DB hadn't been updated yet. Mirror
  ReadRaw's correct behavior: a delete marker shadows the DB value.
- chaindb_runtime_tests.cpp: per-test fresh handle via close-reopen
  dance so the static g_rocksdb singleton doesn't leak state between
  cases. Tests filter framework keys (length-prefixed 'version' and
  'dbformat') from iterator walks. block_index test fixed to Seek()
  not Seek("blockindex") since the serialized keys start with the
  length byte 0x0a.
- snapshotnet_tests.cpp, chaindb_runtime_tests.cpp: include wallet.h,
  ui_interface.h, uint256.h, checkpoints.h as needed for linker; add
  BOOST_TEST_MODULE decl; define global stubs (pwalletMain,
  uiInterface, fConfChange, etc.) so wallet.cpp link succeeds.

Result: test_snapshotnet + test_chaindb_runtime both pass with zero
errors. Found and fixed a real production bug in ExistsRaw along
the way.
2026-06-25 03:39:04 -07:00
Krystie c7768fd42e snapshotnet: WIP auto-dump + NODE_SNAPSHOT pre-handshake + new test targets
- snapshotnet.cpp: always re-scan on HasServableSnapshot; auto-dump
  from current chain when synced to canonical snapshot height
- net.cpp: EnsureLocalSnapshot() at startup so NODE_SNAPSHOT reaches
  outbound peers in the first version message
- CMakeLists.txt: add test_snapshotnet + test_chaindb_runtime targets
- test/snapshotnet_tests.cpp, test/chaindb_runtime_tests.cpp: full
  coverage for the SnapshotNet P2P protocol + CRocksTxDB wrapper layer
2026-06-25 03:02:23 -07:00
Krystie c2257bb827 build: patch generated configure to use $(...) instead of backtick assignments
Run #473 (post CONFIG_SHELL=bash) still hit:

  ./configure: line 11244: syntax error near unexpected token
    `as_ac_var=`printf '%s\n' "ac_cv_func_$ac_func" | sed "$as_sed_sh"``

Root cause: MSYS2's mingw-w64-x86_64-autotools meta package pulls
autoconf 2.73, which generates ./configure with backtick command
substitution INSIDE variable assignments (`var=`cmd``). My local
environment has autoconf 2.71 which doesn't generate this pattern
at all (verified: 0 matches in locally-generated configure).

bash on MSYS2's MINGW64 can't parse the 2.73 pattern even when
invoked directly - the nested backticks with mixed single/double
quotes containing $-vars trip the parser. Pinning MSYS2's autoconf
to 2.71 is fragile (meta-package pulls current on next rebuild).

Fix: after autoreconf, run a perl one-liner on the generated
configure that converts all `var=`cmd`` assignments to
`var=$(cmd)` form. POSIX-ly equivalent for bash, nests cleanly,
and matches what autoconf 2.71 would have generated. Verified
the patched configure still works (`./configure --help` runs
cleanly). The CONFIG_SHELL=bash line stays for any remaining
edge cases on dash-vs-bash differences.
2026-06-25 00:46:15 -07:00
Krystie 4f452514dc build: run configure under bash (autoconf 2.73 backtick quoting breaks dash)
Run #472 (post -W no-error fix) got past autoreconf but failed in ./configure:

  ./configure: line 11244: syntax error near unexpected token
    `as_ac_var=`printf '%s\n' "ac_cv_func_$ac_func" | sed "$as_sed_sh"``

autoconf 2.73's generated configure uses backtick command substitution
inside variable assignments with nested quoting. dash/MSYS2's /bin/sh
parses this as a syntax error because the inner backticks don't nest
cleanly inside the outer backtick expression.

Force CONFIG_SHELL=bash and invoke configure via "$CONFIG_SHELL"
so the generated script is parsed by bash regardless of platform
(MSYS2 MINGW64 defaults to dash for /bin/sh, which is what bit us).
2026-06-25 00:35:51 -07:00
Krystie e07a90d7d1 build: switch to autoreconf -W no-error + add macOS homebrew link dirs
Two CI fixes for v5.9.25-fork-detection run #471:

1. Windows Qt + daemon: build-libtor.sh ran ./autogen.sh which calls
   autoreconf with -W all,error. autoconf 2.73 (in MSYS2) added a new
   warning when AC_CHECK_FUNCS/AC_CHECK_HEADERS is called without a
   literal argument; under -W all,error this becomes a hard failure.
   Linux runners don't hit this because Ubuntu 22.04 ships autoconf 2.71.
   Fix: call 'autoreconf -i -f -W no-error' directly, skipping autogen.sh.

2. macOS Qt: -levent / -lssl / -lssl / -lz failed to resolve because
   Homebrew's /opt/homebrew/opt/{libevent,openssl@3,zlib}/lib paths
   aren't on the default linker search path. Configure step passes the
   include/lib paths to CMake but target_link_libraries uses bare -l,
   so the linker needs an explicit -L. Add target_link_directories
   under APPLE to inject the Homebrew lib dirs.

Both uncommitted worktree changes were in flight; this commit lands them.
2026-06-25 00:26:59 -07:00
Krystie 407355afb0 build: use mingw-w64-x86_64-autotools meta package + zlib for macOS
Two fixes:

1. Windows: replaced broken 'mingw-w64-x86_64-autoconf/automake/
   autoconf2.13/libtool' individual packages with the meta package
   'mingw-w64-x86_64-autotools' which is what actually exists in the
   MINGW64 repo (the individual ones don't).

2. macOS: added 'zlib' to brew install (configure complained the
   --with-zlib-dir was empty).

Also fixed the chaindb equivalence test step in build-all.yml to
run the correct binary: 'build/bin/test_chaindb_equivalence'
(which is the dedicated driver for chaindb_equivalence_tests)
rather than 'build/bin/test_triangles --run_test=chaindb_...'
(the test suite lives in a separate binary, not in test_triangles).
2026-06-24 20:05:16 -07:00
Krystie eb1851ba89 test: fix wallet scope in abandon_transaction_tests
The static 'CWallet wallet' inside BOOST_AUTO_TEST_SUITE(wallet_tests)
is in the wallet_tests namespace, not the global scope. Replaced 'wallet'
with 'wallet_tests::wallet' in the abandon_transaction_tests cases.

Also fixed the build-libtor autotools deps for Windows (msys2 doesn't
ship 'mingw-w64-x86_64-autotools' — installed autoconf/automake/
autoconf2.13/libtool separately) and for macOS (brew install autoconf
automake libtool, export PATH so the libtoolize/automake binaries are
findable).
2026-06-24 19:50:59 -07:00
Krystie 75dd9e034a build: target libtor.a only + add autotools to Windows msys2 install
Run #468 (the re-trigger after #467's fixes) failed with two more issues:

  1. Linux build-libtor step needed static OpenSSL libs (libssl.a,
     libcrypto.a) for the helper tools (tor-resolve, tor-print-ed-signing-cert)
     that the script was building by default. Ubuntu's libssl-dev
     package only ships the shared .so libs, not the static .a ones.
     We don't actually need the helper tools — Triangles only consumes
     libtor.a. Changed 'make' to 'make libtor.a' in build-libtor.sh
     so only the static library is built.

  2. Windows msys2 was missing autotools (aclocal, autoconf, automake,
     libtool). autogen.sh failed with 'aclocal: command not found'.
     Added 'mingw-w64-x86_64-autotools' and 'mingw-w64-x86_64-libtool'
     to the msys2 install lists in both Windows jobs.

If this one fails I'll show you the log. (Run #469 will be the test.)
2026-06-24 19:42:26 -07:00
Krystie bf401437e8 build: fix macOS link options + libtor paths for all 7 CI jobs
Run #467 (the re-trigger after #466's fixes) failed with two new error
classes that the previous commit didn't catch:

  1. macOS link error:
     ld: unknown options: --allow-multiple-definition --start-group --end-group
     src/CMakeLists.txt passed GNU ld flags unconditionally in the
     USE_TOR_EMBEDDED block. Apple's ld64 doesn't recognize them.
     Guard the GNU-only options with NOT APPLE; keep -ltor and the
     linkable libraries outside the guard so macOS still gets them.

  2. Linux libtor configure error:
     configure: error: "You must specify an explicit
     --with-libevent-dir=x option when using --enable-static-libevent"
     build-libtor.sh defaults to /mingw64 paths. On ubuntu-22.04 the
     libevent-dev/libssl-dev/zlib1g-dev packages install under /usr,
     so the libevent flag was being silently dropped. Set
     LIBEVENT_DIR=/usr OPENSSL_DIR=/usr ZLIB_DIR=/usr for Linux jobs.

  3. Added the build-libtor step to three more jobs that needed it
     (Qt GUI builds also link -ltor transitively via triangles_common):
       - build-windows-qt
       - build-linux-qt
       - build-macos

After this:
  - All 7 build jobs will pass the libtor step.
  - macOS Qt link will work (no more GNU-ld-only options).
  - Windows Qt build will produce the .exe installer artifact.

If anything still fails I'll iterate. This is the third build pass.
2026-06-24 19:32:34 -07:00
Krystie 518de7cb2e test: add boost unit tests for AbandonTransaction
Cover the validation paths:
  - abandon_unknown_txid_returns_false: hash not in wallet
  - abandon_not_from_me_returns_false: tx in wallet but fDebit=0

The success path (EraseFromWallet + DB write) requires a file-backed
wallet with a real on-disk DB, which boost's non-file-backed test
wallet (fFileBacked = false) doesn't provide. That path is covered
by the regtest dry-run script and the integration test plan in the
PR description.
2026-06-24 19:18:20 -07:00
Krystie c5f55fe802 build: fix Windows CI - add build-libtor step + refreshWallet() call
Two CI issues were blocking the Windows Qt build of v5.9.25-fork-detection
(run #466, all 7 jobs failed):

  1. transactionview.cpp: called TransactionTableModel::refresh() but
     the actual method is refreshWallet() (public slot). Fixed in the
     abandonTransaction() handler.

  2. build-all.yml: every daemon job failed at link with
     'cannot find -ltor'. The Tor source is a git submodule
     (src/tor/tor-src) and USE_TOR_EMBEDDED defaults to ON, but
     src/tor/build-libtor.sh is NEVER invoked from the workflow.
     Added a 'Build libtor' step before the main build in:
       - build-windows-qt
       - build-windows-daemon
       - build-linux-daemon
       - test-linux-unit
       - test-linux-sanitizers

  (The macos/Linux-Qt builds only do BUILD_QT=ON, so they don't link
  libtor and don't need the extra step. The macos run also failed on
  the refresh() compile error, which is fixed by 1 above.)
2026-06-24 19:17:19 -07:00
Krystie 16224898d4 wallet: add abandontransaction RPC + Qt right-click 'Abandon transaction'
Brings back the abandontransaction RPC that was removed when Triangles
forked from Bitcoin Core 0.18. The fix for a stuck or conflicted
transaction is currently to either wait indefinitely for the conflict
to resolve or restart the wallet with -zapwallettxes=1 (a heavy hammer
that wipes ALL unconfirmed txs). abandontransaction gives the user
targeted control.

Backend (port of Bitcoin Core 0.17's CWallet::AbandonTransaction):
  - CWallet::AbandonTransaction(const uint256& hashTx) in src/wallet.{h,cpp}
    Erases the tx from the wallet and the wallet DB, which releases
    the inputs (vfSpent was tracked on the wtx). Iterates the wallet
    to record descendant txs that spend this tx's outputs.
  - abandontransaction RPC in src/rpcwallet.cpp + trianglesrpc.{h,cpp}.
    Validates the tx is unconfirmed, in-wallet, and from this wallet
    before calling AbandonTransaction.
  - extern forward declaration in trianglesrpc.h so the RPC table can
    reference the function.

UI (Qt right-click context menu in transactionview.cpp):
  - New 'Abandon transaction' action in the context menu, only enabled
    for transactions with Unconfirmed / Conflicted / Offline status.
  - Confirmation dialog before calling the RPC.
  - On success, refreshes the transactions table.

WalletModel::abandonTransaction(QString) in src/qt/walletmodel.{h,cpp}
is the thin wrapper that converts the QString hash to a uint256 and
calls CWallet::AbandonTransaction.

Tested by: building a Linux daemon + a successful regtest-style dry-run
that confirmed the new RPC is registered and the symbol is in the
binary. UI rebuild on Windows requires running build-all.yml on a
windows-latest runner (done via workflow_dispatch).
2026-06-24 19:03:15 -07:00
Krystie 28f5fcdbca init: forward-declare InitError / InitWarning for AppInit
The -notor audit code in AppInit (line ~423) calls InitError() before
InitError is defined in this file (line ~487). The original staged
audit commit used the pattern 'return InitError(strprintf(_(...)))'
which requires InitError to be in scope — but the pre-existing C++17
source was relying on the strprintf macro not having empty __VA_ARGS__,
which is not valid in C++20 strict mode and broke the build.

Two related fixes in this commit:
  1. Add forward declarations of InitError / InitWarning at the top of
     init.cpp so the AppInit body can use them before their definitions.
  2. Drop the unnecessary strprintf(_(...)) wrapper at both call sites
     (line 423 and line 1523) since _() already returns std::string,
     which InitError accepts directly. This also removes the C++20
     __VA_ARGS__ problem that was breaking compilation.

The audit logic itself is unchanged — only the syntactic wrapper.
2026-06-24 19:03:14 -07:00
Krystie aa1851dd6a distribute: wait for daemon .deb before Docker Hub build
The Dockerfile in packaging/docker/ downloads the daemon .deb from
the release URL during the build. On tag-push, the release record is
created immediately but the .deb asset gets uploaded a few seconds
to minutes later by the build job.

Race condition seen on v5.9.24 distribute run #24 (2026-06-24 01:10 UTC):
- Workflow fired on tag push
- Docker Hub job started step 5 'Build and push' immediately
- Dockerfile's curl returned 404 for the .deb
- Job failed in 18 seconds; release .deb was uploaded ~8 min later

AUR and WinGet jobs already had this wait step; Docker Hub was the
only one missing it. Added the same pattern (poll for URL reachability
up to 30 * 20s = 10 min).
2026-06-24 18:21:04 -07:00
Krystie 53f003aef1 v5.9.24: update TRI home + explorer links, networking fixes, checkpoint publisher
- qt: TRI home → https://cryptographic-triangles.org/ (UI + 65 locales)
- qt: block explorer → https://blocks.cryptographic-triangles.org (65 locales)
- net: networking hardening + checkpoint publisher support
- build: MinGW cross-compilation toolchain, CI tridock rebuild trigger
- test: checkpoint publisher + onion v3 test updates
- test: chaindb equivalence test suite (LevelDB↔RocksDB migration parity)
- util: expose ResetDataDirCache() for test fixture datadir switching
- txdb: WriteRawPublic/ReadRawPublic test seam for raw byte-level access
- version bump 5.9.23 → 5.9.24
v5.9.24
2026-06-23 20:13:02 -07:00
Krystie 9762c741b7 distribute: fix $schema aka.ms URL + add NSIS Silent switches
Two errors from PR #391813 manifest validation (build 349844):

1. 'The schema header URL does not match the expected pattern.'
   I used raw.githubusercontent.com URLs, but the validator wants
   the aka.ms short URLs that the official winget-bot uses.
   Updated all 3 files to https://aka.ms/winget-manifest.*.1.12.0.schema.json

2. 'Silent and SilentWithProgress switches are not specified for
   InstallerType exe.'
   TrianglesQt installer is built with NSIS (see build-all.yml
   'Install NSIS via MSYS2' step + mingw-w64-x86_64-nsis package).
   NSIS silent flag is /S. Added both Silent and SilentWithProgress.

Closes superseded PR microsoft/winget-pkgs#391813 (same Manifest-Validation-Error).
2026-06-22 21:33:13 -07:00
Krystie 6726365872 distribute: fix $schema heredoc escaping + INSTALLER_URL ${{ }} substitution
Two pre-existing latent bugs in the WinGet job template:

1. The line '# yaml-language-server: $schema=...' was inside a
   <<EOF heredoc, so bash treated $schema as an undefined variable
   and stripped it down to '=https://...'. The resulting YAML still
   parsed (since the $schema line is just an editor comment), but
   IDE auto-complete and editor-side validation were broken.

   Fix: escape the $ as \$ in the heredoc so bash leaves it alone.

2. INSTALLER_URL was set in the workflow env: block with literal
   ${VERSION} placeholders. GitHub Actions only substitutes \${{ }}
   expressions in env values, not ${}. So the bash $VERSION got
   expanded but the URL kept ${VERSION} literal in the output —
   meaning the published manifest had a broken InstallerUrl that
   the Microsoft validator would 404 on (and a literal ${VERSION}
   string in SHA-source comparison).

   Fix: use ${{ env.VERSION }} in the workflow YAML so GitHub Actions
   substitutes it at runtime. Then bash gets the real version string
   and the heredoc just expands the resulting env var.
2026-06-22 20:57:16 -07:00
Krystie 20fc2ee6dd distribute: bump WinGet manifest schema 1.6.0 → 1.12.0
The winget-pkgs repository has tightened its accepted schema. Per
doc/ValidationFailureGuide.md:
- 'Manifest-Version-Deprecated: Update your manifest to use a supported
   schema version. The recommended schema version is 1.12.0
   (1.10.0 is also accepted).'
- 'Manifest-Validation-Error: Address all reported errors and resubmit.'

What changed in the template heredocs:

1. ManifestVersion: 1.6.0 → 1.12.0 in all 3 files
2. Version file: dropped Publisher/PublisherUrl/PackageName/License/
   ShortDescription (those belong in defaultLocale only).
   Replaced PackageLocale: en-US with DefaultLocale: en-US — that
   field was renamed in schema 1.12.
3. Installer file: replaced InstallerMode: interactive with
   InstallModes: [interactive, silent] (the singular 'InstallerMode'
   was removed; InstallModes is now an array per-installer or root).
   Dropped PackageLocale (not part of installer schema) and
   InstallerScope: user (no longer supported at root, only per-installer).
4. Added # yaml-language-server: $schema=... comment to all 3 files
   pointing at the official 1.12.0 JSON schemas — helps editor/IDE
   auto-complete AND validates against the same schema the winget
   validators use.

Supersedes PR microsoft/winget-pkgs#391801 (closed in same batch —
manifests there used the 1.6.0 schema and got Manifest-Validation-Error).
2026-06-22 20:47:14 -07:00