Skip to content

feat(consensus): gate NSM LTS support#7

Closed
evan-forbes wants to merge 2 commits into
evan/nu7-testnet-plumbingfrom
evan/nu7-nsm-lts
Closed

feat(consensus): gate NSM LTS support#7
evan-forbes wants to merge 2 commits into
evan/nu7-testnet-plumbingfrom
evan/nu7-nsm-lts

Conversation

@evan-forbes

Copy link
Copy Markdown

Motivation

Port NSM/LTS behavior while keeping default Zebra builds and database behavior upstream-compatible.

Solution

Add LTS pool accounting, ZIP-235/NSM payout validation, GBT payout calculation, and NSM pool RPC exposure behind zcash_unstable="nsm". Compile-time checks require nsm builds to also enable nu7 and zip235. Default builds do not use the NSM value-pool encoding or DB minor-version bump.

Tests

  • cargo fmt --all -- --check
  • NSM lib tests on the final stack: CXXFLAGS="-include cstdint" RUSTFLAGS="--cfg zcash_unstable="nu7" --cfg zcash_unstable="zip235" --cfg zcash_unstable="nsm"" cargo test -p zebra-chain -p zebra-consensus -p zebra-state -p zebra-rpc --lib
  • Default targeted checks: CXXFLAGS="-include cstdint" cargo test -p zebra-state --lib test_raw_rocksdb_column_families; CXXFLAGS="-include cstdint" cargo test -p zebra-rpc --lib test_rpc_response_data
  • Earlier focused verification also covered default and NU7-only library tests for the changed crates.

AI Disclosure

Used OpenAI Codex to inspect the branch stack, resolve cherry-pick conflicts, implement gating/test fixes, and run verification.

The `format_upgrades` list unconditionally included a 27.1.0 NoMigration entry for the LTS value-pool format. The migration apply loop in `apply_format_upgrade` iterates over every upgrade whose version is greater than the on-disk version, with no upper bound at the running version, and calls `mark_as_upgraded_to` for each.

In a default build (nsm off) the running database version is 27.0.0. When such a build upgrades any older database it would reach the 27.1.0 entry and `mark_as_upgraded_to` would trip its `format_upgrade_version <= running_version` assertion, panicking the format-change thread. The reference branch never hit this because it is an always-nsm build whose running version is 27.1.0.

Gate the 27.1.0 entry behind `cfg(zcash_unstable = "nsm")` so default builds never see an upgrade version newer than their own running version. This keeps the entry only in nsm builds, where the running version is also 27.1.0 and the assertion holds. Switched the array to a Vec so the entry can be cfg-gated in place.
@evan-forbes evan-forbes force-pushed the evan/nu7-testnet-plumbing branch from aa60d6c to 0f00f0f Compare May 23, 2026 03:15
ValarDragon pushed a commit that referenced this pull request Jun 12, 2026
* feat: add Ubuntu package command (#9)

Cherry-pick the Ubuntu packaging helper from
`/home/evan/src/zcash/nu7-testnet` so this fork can build an Ubuntu
release binary through `cargo xtask package ubuntu`.

Issue: not linked; no issue was provided in the request.

- Add an `xtask` workspace crate with the `package ubuntu` command.
- Add `docker/ubuntu-package.Dockerfile` for the Docker-based Ubuntu
build.
- Update the Docker context allowlist and cargo config needed by the
packaging flow.

- `cargo fmt --all -- --check`
- `cargo check -p xtask`
- `git diff --check origin/main..HEAD`

Note: I did not run `cargo xtask package ubuntu` because it performs a
Docker release build.

Used Codex to cherry-pick the xtask Ubuntu packaging work from the NU7
testnet worktree, apply rustfmt, run focused validation, and prepare
this PR description.

(cherry picked from commit 5ab24f2e386772c2ad4b7788a68930a10d019103)

* feat: add JSONL tracing crate (#7)

## Motivation

Cherry-pick the reusable JSONL tracing package from
`/home/evan/src/zcash/nu7-testnet` so the fork can share non-blocking
JSONL trace writing support without pulling every individual tracing
call site.

Issue: not linked; no issue was provided in the request.

## Solution

- Add the `zebra-jsonl-trace` workspace crate.
- Register it in the workspace.
- Include the package lockfile entries needed by the crate.

## Tests

- `cargo fmt --all -- --check`
- `cargo test -p zebra-jsonl-trace`
- `git diff --check origin/main..HEAD`

## AI Disclosure

Used Codex to cherry-pick the JSONL tracing package from the NU7 testnet
worktree, resolve the workspace-member conflict, run focused validation,
and prepare this PR description.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit b27b508009f0bdeb3806ae93c9ae18ba3ff075a7)

* feat(chain): add local testnet genesis generation (#8)

## Motivation

Cherry-pick the local genesis creation work from
`/home/evan/src/zcash/nu7-testnet` so this fork can generate custom
local testnet seed chains with funded transparent keys.

Issue: not linked; no issue was provided in the request.

## Solution

- Add `zebra_chain::local_genesis` for generating local testnet genesis
and premine blocks.
- Add the follow-up local-genesis fixes from the NU7 branch while
dropping unrelated RPC/getblocktemplate devnet response changes from
that source commit.
- Adapt coinbase input construction to the current 4.5.0 `zebra-chain`
transparent input API.

## Tests

- `cargo fmt --all -- --check`
- `cargo check -p zebra-chain`
- `git diff --check origin/main..HEAD`

## AI Disclosure

Used Codex to cherry-pick and adapt the local genesis generation work
from the NU7 testnet worktree, resolve version drift against this fork,
run focused validation, and prepare this PR description.

(cherry picked from commit 235006267f2157afc7aeaaba399eba5a7c1ad30e)

* fix(state): increase reorg window to 1000 blocks

(cherry picked from commit 3c33139)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@evan-forbes

Copy link
Copy Markdown
Author

Closing as no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant