Skip to content

Commit 0d5ea69

Browse files
committed
Merge branch 'zcash-v4.2.0' into sync-zcash-v4.2.0-merge
2 parents 0bf444b + 12ea9b0 commit 0d5ea69

File tree

252 files changed

+7418
-14543
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+7418
-14543
lines changed

.codespellrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[codespell]
2-
ignore-words-list = crate,Sur,inout,Groth,groth,re-use,abl,
2+
ignore-words-list = crate,Sur,inout,Groth,groth,re-use,abl,zcash,zcashd,zebrad,zebra,utxo,utxos,nullifier,nullifiers,sapling,orchard,sprout,backpressure,proptest,thiserror,rocksdb,libsecp,fullnode,peerset,threadsafe,unrepresentable,getblocktemplate,syncer,Actix,Akka,mermaid,println,eprintln,usize,nocapture,Parallelizable,invis,UTXO,Zcash,Zaino,Zallet,librustzcash,Mainnet,Testnet,mainnet,testnet,idents,reentrancy,serializable,deserializable,deserialization,zkSNARK,zkSNARKs,lightwalletd,statics,ser,endianity,aranges
33
exclude-file = book/mermaid.min.js
4-
skip = ./zebra-rpc/qa/rpc-tests,./supply-chain
4+
skip = ./zebra-rpc/qa/rpc-tests,./supply-chain,./target

.github/ISSUE_TEMPLATE/release.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: "🚀 Zebra Release"
3-
about: 'Zebra team use only'
4-
title: 'Publish next Zebra release: (version)'
5-
labels: 'A-release, C-exclude-from-changelog, P-Medium :zap:'
6-
assignees: ''
7-
3+
about: "Zebra team use only"
4+
title: "Publish next Zebra release: (version)"
5+
labels: "A-release, C-exclude-from-changelog, P-Medium :zap:"
6+
assignees: ""
87
---
98

109
# Prepare for the Release
@@ -16,17 +15,19 @@ They can be skipped for urgent releases.
1615

1716
To check consensus correctness, we want to test that the state format is valid after a full sync. (Format upgrades are tested in CI on each PR.)
1817

19-
- [ ] Make sure there has been [at least one successful full sync test](https://github.com/ZcashFoundation/zebra/actions/workflows/ci-tests.yml?query=event%3Aschedule) since the last state change, or
20-
- [ ] Start a manual workflow run with a Zebra and `lightwalletd` full sync.
18+
- [ ] Make sure there has been [at least one successful full sync test](https://github.com/ZcashFoundation/zebra/actions/workflows/zfnd-ci-integration-tests-gcp.yml?query=event%3Aschedule) since the last state change, or
19+
- [ ] Start a manual workflow run of [`zfnd-ci-integration-tests-gcp.yml`](https://github.com/ZcashFoundation/zebra/actions/workflows/zfnd-ci-integration-tests-gcp.yml) with both `run-full-sync: true` and `run-lwd-sync: true`.
2120

22-
State format changes can be made in `zebra-state` or `zebra-chain`. The state format can be changed by data that is sent to the state, data created within the state using `zebra-chain`, or serialization formats in `zebra-state` or `zebra-chain`.
21+
State format changes can be made in `zebra-state` or `zebra-chain`. The state format can be changed by data that is sent to the state, data created within the state using `zebra-chain`, or serialization formats in `zebra-state` or `zebra-chain`.
2322

2423
After the test has been started, or if it has finished already:
24+
2525
- [ ] Ask for a state code freeze in Slack. The freeze lasts until the release has been published.
2626

2727
## Checkpoints
2828

2929
For performance and security, we want to update the Zebra checkpoints in every release.
30+
3031
- [ ] You can copy the latest checkpoints from CI by following [the zebra-checkpoints README](https://github.com/ZcashFoundation/zebra/blob/main/zebra-utils/README.md#zebra-checkpoints).
3132

3233
## Missed Dependency Updates
@@ -36,7 +37,9 @@ Sometimes `dependabot` misses some dependency updates, or we accidentally turned
3637
This step can be skipped if there is a large pending dependency upgrade. (For example, shared ECC crates.)
3738

3839
Here's how we make sure we got everything:
40+
3941
- [ ] Run `cargo update` on the latest `main` branch, and keep the output
42+
- [ ] Until we bump the MSRV to 1.88 or higher, `home` must be downgraded manually: `cargo update home@0.5.12 --precise 0.5.11`
4043
- [ ] If needed, [add duplicate dependency exceptions to deny.toml](https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/continuous-integration.md#fixing-duplicate-dependencies-in-check-denytoml-bans)
4144
- [ ] If needed, remove resolved duplicate dependencies from `deny.toml`
4245
- [ ] Open a separate PR with the changes
@@ -47,12 +50,15 @@ Here's how we make sure we got everything:
4750
Follow the steps in the [release checklist](https://github.com/ZcashFoundation/zebra/blob/main/.github/PULL_REQUEST_TEMPLATE/release-checklist.md) to prepare the release:
4851

4952
Release PR:
53+
5054
- [ ] Update Changelog
5155
- [ ] Update README
5256
- [ ] Update Zebra Versions
57+
- [ ] Update Crate Versions and Crate Change Logs
5358
- [ ] Update End of Support Height
5459

5560
Publish Release:
61+
5662
- [ ] Create & Test GitHub Pre-Release
5763
- [ ] Publish GitHub Release
5864
- [ ] Publish Rust Crates

.github/ISSUE_TEMPLATE/usability_testing_plan.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: "📋 Usability Testing Plan"
33
about: Create a Usability Testing Plan
4-
title: 'Usability Testing Plan'
4+
title: "Usability Testing Plan"
55
labels: C-research
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
# Usability Testing Plan
@@ -53,7 +52,6 @@ assignees: ''
5352

5453
<!-- What needs to happen for the participant to successfully complete the task -->
5554

56-
5755
## Session Outline and timing
5856

5957
<!-- The following sections provide some space to plan out the script and tasks for your participants -->
@@ -81,4 +79,3 @@ assignees: ''
8179
## Required documentation
8280

8381
<!-- List the documents you will need to produce and bring to the usability testing sessions, e.g consent forms, usability testing script, questionnaires, etc... -->
84-

.github/PULL_REQUEST_TEMPLATE/hotfix-release-checklist.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
name: 'Hotfix Release Checklist Template'
3-
about: 'Checklist to create and publish a hotfix Zebra release'
4-
title: 'Release Zebra (version)'
5-
labels: 'A-release, C-exclude-from-changelog, P-Critical :ambulance:'
6-
assignees: ''
7-
2+
name: "Hotfix Release Checklist Template"
3+
about: "Checklist to create and publish a hotfix Zebra release"
4+
title: "Release Zebra (version)"
5+
labels: "A-release, C-exclude-from-changelog, P-Critical :ambulance:"
6+
assignees: ""
87
---
98

109
A hotfix release should only be created when a bug or critical issue is discovered in an existing release, and waiting for the next scheduled release is impractical or unacceptable.
@@ -55,7 +54,7 @@ follow semver, depending on the thing being fixed.
5554
## Test the Pre-Release (if Zebra hotfix)
5655

5756
- [ ] Wait until the Docker binaries have been built on the hotfix release branch, and the quick tests have passed:
58-
- [ ] [ci-tests.yml](https://github.com/ZcashFoundation/zebra/actions/workflows/ci-tests.yml)
57+
- [ ] [ci-tests.yml](https://github.com/ZcashFoundation/zebra/actions/workflows/ci-tests.yml)
5958
- [ ] Wait until the [pre-release deployment machines have successfully launched](https://github.com/ZcashFoundation/zebra/actions/workflows/zfnd-deploy-nodes-gcp.yml?query=event%3Arelease)
6059

6160
## Publish Release (if Zebra hotfix)

.github/PULL_REQUEST_TEMPLATE/release-checklist.md

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
name: 'Release Checklist Template'
3-
about: 'Checklist to create and publish a Zebra release'
4-
title: 'Release Zebra (version)'
5-
labels: 'A-release, C-exclude-from-changelog, P-Critical :ambulance:'
6-
assignees: ''
7-
2+
name: "Release Checklist Template"
3+
about: "Checklist to create and publish a Zebra release"
4+
title: "Release Zebra (version)"
5+
labels: "A-release, C-exclude-from-changelog, P-Critical :ambulance:"
6+
assignees: ""
87
---
98

109
# Prepare for the Release
@@ -14,6 +13,7 @@ assignees: ''
1413
# Checkpoints
1514

1615
For performance and security, we want to update the Zebra checkpoints in every release.
16+
1717
- [ ] You can copy the latest checkpoints from CI by following [the zebra-checkpoints README](https://github.com/ZcashFoundation/zebra/blob/main/zebra-utils/README.md#zebra-checkpoints).
1818

1919
# Missed Dependency Updates
@@ -23,7 +23,9 @@ Sometimes `dependabot` misses some dependency updates, or we accidentally turned
2323
This step can be skipped if there is a large pending dependency upgrade. (For example, shared ECC crates.)
2424

2525
Here's how we make sure we got everything:
26+
2627
- [ ] Run `cargo update` on the latest `main` branch, and keep the output
28+
- [ ] Until we bump the MSRV to 1.88 or higher, `home` must be downgraded manually: `cargo update home@0.5.12 --precise 0.5.11`
2729
- [ ] If needed, [add duplicate dependency exceptions to deny.toml](https://github.com/ZcashFoundation/zebra/blob/main/book/src/dev/continuous-integration.md#fixing-duplicate-dependencies-in-check-denytoml-bans)
2830
- [ ] If needed, remove resolved duplicate dependencies from `deny.toml`
2931
- [ ] Open a separate PR with the changes
@@ -41,11 +43,12 @@ Once you are ready to tag a release, copy the draft changelog into `CHANGELOG.md
4143
We use [the Release Drafter workflow](https://github.com/marketplace/actions/release-drafter) to automatically create a [draft changelog](https://github.com/ZcashFoundation/zebra/releases). We follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.
4244

4345
To create the final change log:
46+
4447
- [ ] Copy the [**latest** draft
45-
changelog](https://github.com/ZcashFoundation/zebra/releases) into
46-
`CHANGELOG.md` (there can be multiple draft releases)
48+
changelog](https://github.com/ZcashFoundation/zebra/releases) into
49+
`CHANGELOG.md` (there can be multiple draft releases)
4750
- [ ] Delete any trivial changes
48-
- [ ] Put the list of deleted changelog entries in a PR comment to make reviewing easier
51+
- [ ] Put the list of deleted changelog entries in a PR comment to make reviewing easier
4952
- [ ] Combine duplicate changes
5053
- [ ] Edit change descriptions so they will make sense to Zebra users
5154
- [ ] Check the category for each change
@@ -56,12 +59,14 @@ To create the final change log:
5659
README updates can be skipped for urgent releases.
5760

5861
Update the README to:
62+
5963
- [ ] Remove any "Known Issues" that have been fixed since the last release.
6064
- [ ] Update the "Build and Run Instructions" with any new dependencies.
6165
Check for changes in the `Dockerfile` since the last tag: `git diff <previous-release-tag> docker/Dockerfile`.
6266
- [ ] If Zebra has started using newer Rust language features or standard library APIs, update the known working Rust version in the README, book, and `Cargo.toml`s
6367

6468
You can use a command like:
69+
6570
```sh
6671
fastmod --fixed-strings '1.58' '1.65'
6772
```
@@ -88,20 +93,11 @@ This check runs automatically on pull requests with the `A-release` label. It mu
8893

8994
Zebra follows [semantic versioning](https://semver.org). Semantic versions look like: MAJOR.MINOR.PATCH[-TAG.PRE-RELEASE]
9095

91-
Choose a release level for `zebrad`. Release levels are based on user-visible changes:
96+
Choose a release level for `zebrad`. Release levels are based on user-visible changes from the changelog:
9297

93-
- Major release: breaking changes to RPCs (fields changed or removed), config files (fields
94-
changed or removed), command line (arguments changed or removed), features
95-
(features changed or removed), environment variables (changed or removed)
96-
or any other external interface of Zebra
97-
- Minor release: new features are `minor` releases
98-
- Patch release: otherwise
99-
100-
Update the version using:
101-
102-
```
103-
cargo release version --verbose --execute --allow-branch '*' -p zebrad patch # [ major | minor ]
104-
```
98+
- Mainnet Network Upgrades are `major` releases
99+
- significant new features or behaviour changes; changes to RPCs, command-line, or configs; and deprecations or removals are `minor` releases
100+
- otherwise, it is a `patch` release
105101

106102
## Update Crate Versions and Crate Change Logs
107103

@@ -144,6 +140,7 @@ cargo release replace --verbose --execute --allow-branch '*' -p <crate>
144140

145141
The end of support height is calculated from the current blockchain height:
146142

143+
- [ ] Find where the Zcash blockchain tip is now by using a [Zcash Block Explorer](https://mainnet.zcashexplorer.app/) or other tool.
147144
- [ ] Replace `ESTIMATED_RELEASE_HEIGHT` in [`end_of_support.rs`](https://github.com/ZcashFoundation/zebra/blob/main/zebrad/src/components/sync/end_of_support.rs) with the height you estimate the release will be tagged.
148145

149146
<details>
@@ -160,7 +157,6 @@ The end of support height is calculated from the current blockchain height:
160157

161158
- [ ] Push the version increments and the release constants to the release branch.
162159

163-
164160
# Publish the Zebra Release
165161

166162
## Create the GitHub Pre-Release
@@ -182,7 +178,7 @@ The end of support height is calculated from the current blockchain height:
182178
## Test the Pre-Release
183179

184180
- [ ] Wait until the Docker binaries have been built on `main`, and the quick tests have passed:
185-
- [ ] [zfnd-ci-integration-tests-gcp.yml](https://github.com/ZcashFoundation/zebra/actions/workflows/zfnd-ci-integration-tests-gcp.yml?query=branch%3Amain)
181+
- [ ] [zfnd-ci-integration-tests-gcp.yml](https://github.com/ZcashFoundation/zebra/actions/workflows/zfnd-ci-integration-tests-gcp.yml?query=branch%3Amain)
186182
- [ ] Wait until the [pre-release deployment machines have successfully launched](https://github.com/ZcashFoundation/zebra/actions/workflows/zfnd-deploy-nodes-gcp.yml?query=event%3Arelease)
187183

188184
## Publish Release
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: 'Setup Zebra Build Environment'
2+
description: 'Install protoc as system library'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Install protoc on Ubuntu
7+
if: runner.os == 'Linux'
8+
shell: bash
9+
run: |
10+
sudo apt-get -qq update
11+
sudo apt-get -qq install -y --no-install-recommends protobuf-compiler
12+
13+
- name: Install protoc on macOS
14+
if: runner.os == 'macOS'
15+
shell: bash
16+
run: |
17+
brew install protobuf
18+
19+
- name: Install protoc on Windows
20+
if: runner.os == 'Windows'
21+
shell: bash
22+
run: |
23+
choco install protoc -y

.github/copilot-instructions.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Zebra — Copilot Review Instructions
2+
3+
You are reviewing PRs for Zebra, a Zcash full node in Rust. Prioritize correctness, consensus safety, DoS resistance, and maintainability. Stay consistent with existing Zebra conventions. Avoid style-only feedback unless it clearly prevents bugs.
4+
5+
If the diff or PR description is incomplete, ask questions before making strong claims.
6+
7+
## Contribution Process Checks
8+
9+
Before reviewing code quality, verify:
10+
11+
- [ ] PR links to a pre-discussed issue
12+
- [ ] PR description includes Motivation, Solution, and Tests sections
13+
- [ ] PR title follows conventional commits
14+
- [ ] If AI tools were used, disclosure is present in the PR description
15+
16+
If these are missing, note it in the review.
17+
18+
## Architecture Constraints
19+
20+
```text
21+
zebrad (CLI orchestration)
22+
→ zebra-consensus (verification)
23+
→ zebra-state (storage/service boundaries)
24+
→ zebra-chain (data types; sync-only)
25+
→ zebra-network (P2P)
26+
→ zebra-rpc (JSON-RPC)
27+
```
28+
29+
- Dependencies flow **downward only** (lower crates must not depend on higher crates)
30+
- `zebra-chain` is **sync-only** (no async / tokio / Tower services)
31+
- State uses `ReadRequest` for queries, `Request` for mutations
32+
33+
## High-Signal Checks
34+
35+
### Tower Service Pattern
36+
37+
If the PR touches a Tower `Service` implementation:
38+
39+
- Bounds must include `Send + Clone + 'static` on services, `Send + 'static` on futures
40+
- `poll_ready` must call `poll_ready` on all inner services
41+
- Services must be cloned before moving into async blocks
42+
43+
### Error Handling
44+
45+
- Prefer `thiserror` with `#[from]` / `#[source]`
46+
- `expect()` messages must explain **why** the invariant holds:
47+
```rust
48+
.expect("block hash exists because we just inserted it") // good
49+
.expect("failed to get block") // bad
50+
```
51+
- Don't turn invariant violations into misleading `None`/defaults
52+
53+
### Numeric Safety
54+
55+
- External/untrusted values: prefer `saturating_*` / `checked_*`
56+
- All `as` casts must have a comment justifying safety
57+
58+
### Async & Concurrency
59+
60+
- CPU-heavy crypto/proof work: must use `tokio::task::spawn_blocking`
61+
- All external waits need timeouts and must be cancellation-safe
62+
- Prefer `watch` channels over `Mutex` for shared async state
63+
- Progress tracking: prefer freshness ("time since last change") over static state
64+
65+
### DoS / Resource Bounds
66+
67+
- Anything from attacker-controlled data must be bounded
68+
- Use `TrustedPreallocate` for deserialization lists/collections
69+
- Avoid unbounded loops/allocations
70+
71+
### Performance
72+
73+
- Prefer existing indexed structures (maps/sets) over iteration
74+
- Avoid unnecessary clones (structs may grow over time)
75+
76+
### Complexity (YAGNI)
77+
78+
When the PR adds abstraction, flags, generics, or refactors:
79+
80+
- Ask: "Is the difference important enough to complicate the code?"
81+
- Prefer minimal, reviewable changes; suggest splitting PRs when needed
82+
83+
### Testing
84+
85+
- New behavior needs tests
86+
- Async tests: `#[tokio::test]` with timeouts for long-running tests
87+
- Test configs must use realistic network parameters
88+
89+
### Observability
90+
91+
- Metrics use dot-separated hierarchical names with existing prefixes (`checkpoint.*`, `state.*`, `sync.*`, `rpc.*`, `peer.*`, `zcash.chain.*`)
92+
- Use `#[instrument(skip(large_arg))]` for tracing spans
93+
94+
### Changelog & Release Process
95+
96+
- User-visible changes need a `CHANGELOG.md` entry under `[Unreleased]`
97+
- Library-consumer-visible changes need the crate's `CHANGELOG.md` updated
98+
- PR labels must match the intended changelog category (`C-bug`, `C-feature`, `C-security`, etc.)
99+
- PR title follows conventional commits (squash-merged to main)
100+
101+
## Extra Scrutiny Areas
102+
103+
- **`zebra-consensus` / `zebra-chain`**: Consensus-critical; check serialization, edge cases, overflow, test coverage
104+
- **`zebra-state`**: Read/write separation, long-lived locks, timeouts, database migrations
105+
- **`zebra-network`**: All inputs are attacker-controlled; check bounds, rate limits, protocol compatibility
106+
- **`zebra-rpc`**: zcashd compatibility (response shapes, errors, timeouts), user-facing behavior
107+
- **`zebra-script`**: FFI memory safety, lifetime/ownership across boundaries
108+
109+
## Output Format
110+
111+
Categorize findings by severity:
112+
113+
- **BLOCKER**: Must fix (bugs, security, correctness, consensus safety)
114+
- **IMPORTANT**: Should fix (maintainability, likely future bugs)
115+
- **SUGGESTION**: Optional improvement
116+
- **NITPICK**: Minor style/clarity (keep brief)
117+
- **QUESTION**: Clarification needed
118+
119+
For each finding, include the file path and an actionable suggestion explaining the "why".

0 commit comments

Comments
 (0)