Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fa693c8
beta7: beta7: crash-safety — graceful DB-flush failure + ThreadImport…
Jun 5, 2026
01e5c97
beta7: beta7: P2P DoS hardening — blocklocator bound, mempool rate-li…
Jun 5, 2026
138573c
beta7: beta7: memory-safety — prevector capacity overflow guard + str…
Jun 5, 2026
c1de636
beta7: beta7: RPC/HTTP hardening — timing-safe auth, JSON depth limit…
Jun 5, 2026
0597a77
beta7: beta7: fix user -addnode starved/ignored by bootstrap-peer inj…
Jun 5, 2026
482a7d7
beta7: z_sendmany optional `inputs` coin-control (transparent + sapli…
Jun 6, 2026
3365d0d
coincontrol: spend the EXACT pinned shielded note set (Sapling + Sprout)
Jun 6, 2026
29af294
beta7: perf tuning — leveldb max_open_files scaling + HTTP workqueue …
Jun 6, 2026
0343216
beta7: -addnode phase-2 — respect -connect + prioritize user -addnode…
Jun 6, 2026
578503a
beta7: wallet perf — single AvailableCoins pass in SelectCoins + limi…
Jun 6, 2026
5514712
zslp: port ZSLP SLP Token Type 1 protocol library + gtest
Jun 6, 2026
881da7b
zslp: NFT Phase A — token indexer + read-only RPCs (NON-consensus)
Jun 6, 2026
209befc
zslp: bound zslp_listmytokens response (ZSLP_LIST_MAX) per review
Jun 6, 2026
4354084
zslp: fix reorg undo clobber — accumulate per-token/per-balance chang…
Jun 6, 2026
77cdc02
nft: native ZSLP NFT feature — mint, view, shield, sell (non-consensu…
Jun 6, 2026
f9c143c
nft(shield): cross-wallet receive — reconstruct z_getdatatransfer fro…
Jun 6, 2026
e2c7777
docs(nft): capability vision + privacy-tech + native-display UX + API…
Jun 6, 2026
0ce2d81
nft(daemon): DRY de-dup + API consistency + dispatcher/ZDC/no-fork gt…
Jun 7, 2026
40e08ac
docs(beta7): platform blueprints + ZNAM determinism spec + handoff
Jun 8, 2026
1ac01af
beta7 platform WIP checkpoint: ZNAM names + embedded Tor + marketplace
Jun 8, 2026
93901dc
merge: beta7/crash-safety — DB flush + ThreadImport guard
Jun 9, 2026
e8eb84a
merge: beta7/perf-tuning — leveldb max_open_files + HTTP workqueue
Jun 9, 2026
48f9dd0
merge: beta7/rpc-hardening — timing-safe auth, JSON depth/batch/size …
Jun 9, 2026
1d6c374
merge: beta7/p2p-dos-hardening — blocklocator bound, mempool rate-lim…
Jun 9, 2026
08bf31d
merge: beta7/addnode-connect-respect — bootstrap peer ordering fix
Jun 9, 2026
6e39948
merge: beta7/addnode-peering — IP-literal fast retry + resolve logging
Jun 9, 2026
d5cdc45
merge: beta7/wallet-perf — single AvailableCoins pass + limit-aware l…
Jun 9, 2026
55648ae
merge: beta7/coincontrol-inputs — z_sendmany inputs parameter + shiel…
Jun 9, 2026
15b285d
merge: feature/beta7-platform — ZSLP/NFT/Tor/blockindex-cache (115 fi…
Jun 9, 2026
5c45179
docs(beta7): update README version from beta6 to beta7
Jun 9, 2026
c847e21
feat(zmarket): spider/router/index C hot-path modules for beta7
Jun 9, 2026
c1d09f8
Merge remote-tracking branch 'origin/feature/beta7-platform' into bet…
Jun 9, 2026
4ed00a4
feat(zmarket): onion endpoints + expanded record enum + 5 new invariants
Jun 9, 2026
0e45dd5
fix beta7 docs and clean checkout inputs
Jun 9, 2026
35f64c9
docs(beta7): fix marketplace blueprint whitespace
Jun 9, 2026
57959e4
docs(beta7): add release candidate handoff
Jun 9, 2026
d6cbdb5
tor: honor disabled embedded tor configure value
Jun 9, 2026
b0e2062
docs: clarify beta7 release candidate handoff
Jun 9, 2026
40e1c9c
qa: make beta7 source gate ref safe
Jun 9, 2026
b45cf62
zmarket: fix spider router index invariants
Jun 9, 2026
97888f6
docs: record beta7 zmarket retest
Jun 9, 2026
3280595
depends: vendor zlib source for beta7 CI
Jun 9, 2026
1f4a1de
docs: update beta7 PR handoff
Jun 9, 2026
5472c94
depends: preserve valid vendored sources without stamps
Jun 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions BETA7_HANDOFF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# ZClassic v2.1.2-beta7 — Developer Handoff

**Date:** 2026-06-08 · **Branch:** `beta7/zmarket-spider-router-index` (daemon repo) · **Coin:** ZClassic / ZCL
(never ZEC/Zcash in user-facing strings)

This is the beta7 daemon handoff. The current branch is intended to merge to
`master` through the protected-branch PR path after CI and maintainer approval.

---

## 0. TL;DR status

| Area | State | Green? | Next |
|------|-------|--------|------|
| **ZNAM names — parser + C++ bridge** | landed this session | ✅ 22/22 gtest, full suite 431 | indexer |
| **ZNAM determinism spec** | authoritative, matches ported parser | n/a | owner sign-off on §12 constants |
| **ZNAM indexer / store / RPC / wallet** | NOT started | — | see §3 (design is fully worked out) |
| **Embedded Tor T1 (compile-in)** | done | ✅ `TorEmbed` 3/3 | — |
| **Embedded Tor T2 (onion bring-up + DEANON guard)** | proven end-to-end on real Tor net | ✅ | fold fork-hardening |
| **Embedded Tor T3 stage-1 (v3 identity load-bearing)** | done | ✅ `TorV3Identity` 5/5 | stages 1b–1d |
| **Tor auth_cb 9050 bug** | fix APPLIED in init.cpp | ⚠️ not yet rebuilt | batch into next build |
| **T3 stages 1b–1d (BIP155 ADDRv2 serialize/addrman/negotiate)** | NOT started | — | task #145 |
| **Marketplace P1–P3 (bounds, RAM offerpool, gossip)** | committed earlier + WIP | partial | P4–P5 RPCs + name↔offer sig |
| **GUI Names/Market/Tor tabs (zcl-qt-wallet)** | NOT started | — | separate repo |
| **Version macro** | `CLIENT_VERSION_BUILD = 6` (beta7 track) | — | finalize at release |

**Integrated full-tree build status:** verified by the beta7 audit before the
dependency-source-only CI fix. At daemon head
`97888f616c5be09651508f8b1789ef1e0a4f8111`, `./src/zcash-gtest` passed 472/472
executed tests with 1 disabled test. The current PR head adds only the zlib
source tarball, ignore allowlisting, and source-gate checksum coverage.

---

## 1. How to build (proot, no Docker / no root)

The reproducible build runs in an Ubuntu-20.04 (glibc 2.31) proot rootfs at `/home/rhett/zclbuild`.

```
cd /home/rhett/zclbuild && ./prun bash /build/<script>.sh
```

Binds inside proot: `/src/daemon` = this repo (host) · `/build/daemon` = the build tree ·
`/src/wallet` = the zcl-qt-wallet repo. Prefix: `/build/daemon/depends/x86_64-unknown-linux-gnu`.

Proven build scripts (`/home/rhett/zclbuild/focal/build/`):
- `p7-znam-parser.sh` — full ZNAM gtest build (autogen → config.status --recheck → make zcash-gtest).
- `p7b-znam-fix.sh` — lean rebuild (single file, no autogen).
- `p6-t3s1-torv3-identity.sh` — Tor T3 stage-1 gtest build (the canonical "small recompile" template).
- `p5-tor-depends.sh`, `p5b-tor-only.sh`, `p5c-tor-link.sh` — embedded-Tor depends + link.

**LESSON (do not repeat):** never run a bare `automake`; it bumps `aclocal.m4`'s timestamp → forces a
full `config.status` → `configure` → "libdb_cxx headers missing" abort + a *stale* gtest binary that
silently runs (false pass). Always use `./autogen.sh` then
`CONFIG_SITE=$PFX/share/config.site ./config.status --recheck`.

### Vendored depends source tarballs
The clean-checkout CI/release path tracks the dependency tarballs that dead or
restricted upstream mirrors have already broken:

- `depends/sources/tor-73bd405.tar.gz`
- source: `github.com/RhettCreighton/tor` branch `dynhost` @ `73bd405` (Tor 0.4.9.2-alpha)
- sha256: `178fb8242d5a1066c3535f1328d8b5ef1e4578e318a8e622d6a6732144fa2517`
- `depends/sources/zlib-1.3.1.tar.gz`
- source: `https://zlib.net/fossils/zlib-1.3.1.tar.gz`
- sha256: `9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23`

`qa/beta7/check-source-gates.sh` verifies both tarballs from the candidate ref.
No manual download stamp is required for a clean checkout; depends creates its
own stamps during the build.

For historical context, the Tor source is:
- source: `github.com/RhettCreighton/tor` branch `dynhost` @ `73bd405` (Tor 0.4.9.2-alpha)
- depends `make` MUST carry `NO_PROTON=1` (proton/AMQP needs cmake, absent in the focal proot).

---

## 2. ZNAM (ZCL Names) — what landed this session ✅

A non-consensus on-chain name registry (`OP_RETURN` overlay, exactly like ZSLP/NFT — never touches
consensus). Ported from `github.com/RhettCreighton/zclassic-c` `lib/znam` (Apache-2.0, Rhett Creighton).

**Files added (daemon side, all green):**
- `src/znam/znam.{h,c}` — pure-C parser + OP_RETURN builder. Lokad `"ZNAM"`, version 1, 6 commands
(REGISTER/UPDATE/TRANSFER/RENEW/SET_RECORD/SET_TEXT), 7 target types (ONION/ZADDR/TADDR/BTC/LTC/
DOGE/CONTENT), names `[a-z0-9-]` 1..63. Shares `src/zslp/op_return_push.h` with `slp.c`.
- `src/znam/znammsg.{h,cpp}` — C++ bridge (mirrors `zslp/zslpmsg`): `ZNAMParseScript` +
`ZNAMBuild*` + `ZNAMValidateName`. The ONLY TU that includes the C header (inside `extern "C"`).
static_asserts pin the enum codes to the permanent wire numbers.
- `src/gtest/test_znam.cpp` — 22 round-trip + rejection tests.
- Wired into `src/Makefile.am` (znam.c → libbitcoin_common, znammsg.cpp → libbitcoin_server, headers
→ BITCOIN_CORE_H) and `src/Makefile.gtest.include`.

**Bug fixed during the port:** the reference `znam_build_set_text` emitted a bare `0x00` (OP_0) for an
empty value (record deletion), which this codebase's `read_push` cannot decode (it accepts
`0x01..0x4b`/`0x4c`/`0x4d` only). Fixed to emit the canonical empty push `0x4c 0x00`. Caught by the
round-trip gtest.

**Permanent-bytes spec:** `doc/platform/ZNAM_DETERMINISM_SPEC.md` — authoritative, matches the parser
byte-for-byte. **§12 has the constants that need owner sign-off before mainnet** (REGISTRATION_DURATION
~210000 blocks, GRACE ~52500, MAX_REGISTRATION ~2.1M, RESERVE_BURN default 0). These are non-consensus
indexer policy, tunable on regtest/testnet right up to mainnet activation; they don't change wire bytes.

## 3. ZNAM indexer/RPC/wallet — design is fully worked out, NOT yet coded (next task #147→#148)

Clone the proven ZSLP pattern. The structural map (file:line) is in the agent recon above; the key
seams to mirror:
- **Indexer** `CZNAMIndexer : CValidationInterface` (model `src/zslp/zslpindexer.{h,cpp}`): `ChainTip`
→ ConnectBlock/DisconnectBlock; background catch-up worker; OpenStore + version-stamp migration;
`-znamindex` flag in `init.cpp` (mirror `-zslpindex` at init.cpp:~3345 + Shutdown calls).
- **Store** `CZNAMStore : CDBWrapper` (model `src/zslp/zslpstore.{h,cpp}`) at `blocks/znam/`. Schema in
spec §10. LIFO undo log (`CZNAMUndoOp`) + tip marker + version stamp.
- **THE ONE NEW MECHANIC vs ZSLP — owner = vin[0] P2PKH signer (spec §4):** ZSLP only needed addresses
of its own token outputs; ZNAM needs the address that authorized `vin[0]`. Resolve it deterministically
from the block's **undo data**: `UndoReadFromDisk(blockUndo, pindex->GetUndoPos(),
pindex->pprev->GetBlockHash())` (main.cpp:2250), then `blockUndo.vtxundo[i-1].vprevout[0].txout.
scriptPubKey` (undo.h `CTxInUndo::txout`) → `ExtractDestination` → if exactly `TX_PUBKEYHASH`
(CKeyID), `EncodeDestination` = owner; **else the record is a no-op (P2PKH-or-drop).** This is a total
function of the confirmed chain and is exactly what disconnect already uses to restore coins.
- **RPC** `rpc/znam.cpp` (model `rpc/zslp.cpp`): `name_register/update/transfer/renew/setrecord/settext`
(wallet) + `name_resolve/list/listmine/info/history` (read). Register via `rpc/register.h`.
- **Wallet** `wallet/znamwallet.cpp` (model `wallet/zslpwallet.cpp` `BuildAndCommitZSLP`): build the
OP_RETURN via `ZNAMBuild*`, fund the owner address from a **dedicated `names` derivation path**
(privacy, spec §4.4), emit the reserve-burn output if RESERVE_BURN>0, self-validate before broadcast.
- **gtests** `test_znam_indexer.cpp`: the §13 conformance vectors (FIFS, auth, transfer,
reorg-across-transfer, expiry/grace, SET_TEXT ASCII allowlist, P2PKH-or-drop).

---

## 4. Embedded Tor — see `doc/net/EMBEDDED_TOR_BLUEPRINT.md` + memory `embedded-tor-build-status`

T1/T2/T3-s1 done & green. **auth_cb fix is applied in `init.cpp` but not yet rebuilt — batch it into
the next build.** Next: T3 stages 1b–1d (version-gated BIP155 serializer + `CADDR_ADDRV2_VERSION`,
peers.dat v1→v2, sendaddrv2/addrv2 + per-peer `fSendAddrV2` negotiation), then a deep networking
review. Two **fork-hardening** items to fold into the alpha→stable Tor rebase (do once, on stable, in
the RhettCreighton/tor dynhost branch): (1) relay.c:1707 notice-level log spam on the hot data-cell
path (44k lines/3min) → drop to debug; (2) unused dynhost beacon (dynhost_sys.c:49) auto-creates a 2nd
ephemeral onion → disable. Tor fork is 0.4.9.2-**alpha** — rebase onto stable + CVE process BEFORE any
default-on. Windows: compile-in on all platforms (owner decision); code-sign + VirusTotal-measure at
release (AV flags the whole binary even with `-embeddedtor` OFF).

## 5. Marketplace — see `doc/nft/MARKETPLACE_*` + memory `marketplace-tor-relay-convergence`
P1 (offer bounds), P2 (RAM offerpool `src/nft/offerpool`), P3 (5-msg P2P gossip) done. Next: P4/P5
publish RPCs + multi-node regtest; bind "listed by alice.zcl" by **signature** over the owner P2PKH key
(`signmessage`/`verifymessage`, spec §11) — never by coin co-location (deanon finding); route relay
over the embedded-Tor onion conduit; Hashcash PoW-gate gossip (task #143). `-nftmarket` default OFF
(interim); flip ON once Tor relay ships.

## 6. Also in this checkpoint
- **NFT collections + content-fingerprint** (`src/zslp/contentfingerprint.*`, group/child 'g' index).
- **Datachannel / ZDC1 removed** (deletions of `src/datachannel/*`, `rpc/datachannel.*`,
`asyncrpcoperation_senddatafile.*`) — superseded; the shielded data path was consolidated.
- **blockindex-cache** WIP (memory `blockindex-cache-status`).
- **Lots of design docs** under `doc/nft/`, `doc/net/`, `doc/platform/`.

---

## 7. Tasks (this session created #146–#152)
- #146 ✅ ZNAM parser+bridge+gtest · #147 ⏳ ZNAM indexer+store · #148 ZNAM RPC+wallet
- #149 Tor auth_cb rebuild + T3 1b–1d · #150 marketplace Tor-relay + sig binding + PoW
- #151 GUI tabs (zcl-qt-wallet) · #152 release wrap (master HELD)
- Long-running: #144 (embedded Tor), #145 (BIP155), #139 (marketplace P4/P5), #143 (PoW gossip).

## 8. Hard rules for whoever picks this up
- **NON-consensus only.** ZNAM/ZSLP/marketplace are OP_RETURN overlays + observers. Never touch
consensus, PoW, block/tx validity, mempool acceptance, or wallet spends.
- **Never disturb the live mainnet node** (datadir `~/.zclassic`). Build in the proot tree; run
daemons only on throwaway regtest datadirs under /tmp.
- **One proot build at a time. No non-interactive sudo.**
- **Master is protected.** Merge beta7 through PR #132 after required checks pass.
- Determinism IS security for the overlays — every rule a total function; wire bytes are permanent.
140 changes: 140 additions & 0 deletions BETA7_RELEASE_CANDIDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# ZClassic Beta7 Release Candidate Handoff

Status: daemon release-candidate handoff.
Candidate branch: `origin/beta7/zmarket-spider-router-index`
Candidate head: resolve at final audit time with
`git rev-parse origin/beta7/zmarket-spider-router-index`.
Latest local ZMARKET/source-gate verified non-doc head:
`3280595b20139b735f28b9f1244d9b360b6367b9`.
Original daemon code candidate:
`97888f616c5be09651508f8b1789ef1e0a4f8111`.
The current head adds only a vendored zlib source tarball, ignore-rule
allowlisting, and source-gate checksum coverage so GitHub Actions clean
checkouts do not fail while fetching zlib.
Base: `origin/master` at `14a83d510ffd109d3fa09bf74ebf8c28854a263f`

## What This Candidate Contains

- Worker 3 integration branch `origin/feature/beta7-platform`:
- beta7 hardening branches;
- ZSLP/NFT sources and tests;
- embedded Tor/Tor v3 identity sources and tests;
- NFT offerpool/RPC sources and tests;
- block index cache and wallet performance work.
- Worker 2 ZMARKET C hot-path branch:
- `src/zmarket/zmarket_record.{h,c}`;
- `src/zmarket/zmarket_policy.{h,c}`;
- `src/zmarket/zmarket_index.{h,c}`;
- `src/zmarket/zmarket_content.{h,c}`;
- `src/zmarket/zmarket_onion.{h,c}`;
- `src/zmarket/zmarket_spider.{h,c}`;
- `src/zmarket/zmarket_router.{h,c}`;
- `src/gtest/test_zmarket_c.cpp`;
- `src/gtest/test_zmarket_spider_router.cpp`.
- Clean-checkout dependency source fixes:
- tracked `depends/sources/tor-73bd405.tar.gz`;
- SHA256 `178fb8242d5a1066c3535f1328d8b5ef1e4578e318a8e622d6a6732144fa2517`;
- tracked `depends/sources/zlib-1.3.1.tar.gz`;
- SHA256 `9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23`.
- Beta7 product, release, AI, social, content mirror, and ZMARKET routing docs.
- `qa/beta7/check-source-gates.sh` for fast static source verification.

## Gates Already Reported Passed

Worker 3 reported on `origin/feature/beta7-platform @ 5c45179bf`:

- clean daemon build;
- `zcash-gtest`: 396/396 test cases across 72 suites;
- no linker, Tor, libevent, or `evthread_use_pthreads` issues.

Worker 2 reported on the ZMARKET integration:

- strict C compile for ZMARKET C modules;
- C++ test compile for ZMARKET tests;
- expanded onion endpoint invariants;
- no file-hosting side effects from spider/router/index modes.

Local static checks on `origin/beta7/zmarket-spider-router-index`:

```bash
qa/beta7/check-source-gates.sh origin/master origin/beta7/zmarket-spider-router-index
git diff --check origin/master..origin/beta7/zmarket-spider-router-index
git diff --name-status origin/master..origin/beta7/zmarket-spider-router-index -- \
src/consensus src/primitives src/script src/chainparams.cpp src/chainparams.h \
src/pow.cpp src/pow.h src/coins.cpp src/coins.h src/undo.h
git show origin/beta7/zmarket-spider-router-index:depends/sources/tor-73bd405.tar.gz | sha256sum
git show origin/beta7/zmarket-spider-router-index:depends/sources/zlib-1.3.1.tar.gz | sha256sum
```

Results:

- source gate passed;
- `./src/zcash-gtest --gtest_filter='ZMarket*'` passed: 35/35 tests;
- whitespace diff check passed;
- no direct consensus-path diff in the listed paths;
- Tor and zlib tarball hashes matched;
- PR #132 was opened because branch protection rejects direct pushes to master.

## Required Final Audit Before Master

Agent 3 should perform a read-only final audit on:

```bash
git fetch origin
git rev-parse origin/beta7/zmarket-spider-router-index
qa/beta7/check-source-gates.sh origin/master origin/beta7/zmarket-spider-router-index
./src/zcash-gtest --gtest_filter='ZMarket*'
```

Then run or confirm:

- clean native daemon build from a clean checkout;
- `make -C src zcash-gtest_check V=1`;
- no consensus-sensitive behavior changes;
- `-nftmarket` remains default off;
- content hosting remains default off and allowlist-only;
- AI is docs/GUI-side only and cannot produce daemon/provider side effects;
- GUI legacy private file transport is hidden or dev-gated before beta7 GUI release.

## Protected Master Merge Path

Direct master push is intentionally blocked by GitHub branch protection:

```text
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: - Changes must be made through a pull request.
```

Use PR #132 (`beta7/zmarket-spider-router-index` -> `master`). Do not squash,
rebase, force-push, or tag during the PR merge path. After GitHub checks pass,
merge only in a way that preserves the beta7 commit history cleanly.

Read-only fast-forward sanity check:

```bash
git fetch origin
CANDIDATE=$(git rev-parse origin/beta7/zmarket-spider-router-index)

git merge-base --is-ancestor origin/master origin/beta7/zmarket-spider-router-index
git diff --name-status origin/master..$CANDIDATE -- \
src/consensus src/primitives src/script src/chainparams.cpp src/chainparams.h \
src/pow.cpp src/pow.h src/coins.cpp src/coins.h src/undo.h
```

## GUI Release Track

Daemon master is not the final beta7 release by itself. The GUI wallet still
needs:

- beta7 daemon embedded/package update;
- Linux portable build in `/home/rhett/zclbuild`;
- real-display matrix;
- Windows manual daemon footer embed;
- macOS sibling daemon packaging/codesign;
- AI assistant docs/denylist and provider-disabled defaults;
- legacy on-chain private file transport hidden or dev-gated.

Reference GUI docs:

- `/home/rhett/github/zcl-qt-wallet/docs/BETA7_TOR_ZMARKET_ZNAM_GUI_PLAN.md`
- `/home/rhett/github/zcl-qt-wallet/docs/BETA7_AI_ASSISTANT_GUI_PLAN.md`
Loading
Loading