Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZSA integration (step 1): Integrate ZSA-compatible crates into Zebra while maintaining original Orchard (Vanilla) support for now [to upstream #23

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e535649
fix(docker): allow the `zebra` user access to relevant dirs (#8817)
gustavovalverde Aug 29, 2024
c30f20f
fix(state): Write database format version to disk atomically to avoid…
arya2 Aug 29, 2024
6879118
fix(rpc): Return verification errors from `sendrawtransaction` RPC me…
arya2 Aug 30, 2024
911f06d
fix(deps): Replace `serde_yaml` by `serde_yml` (#8825)
upbqdn Sep 2, 2024
546d4be
Remove `shielded-scan` from experimental features (#8827)
upbqdn Sep 3, 2024
a58ece8
add(docs): Add minimal hardware requirements (#8822)
upbqdn Sep 3, 2024
1ff703d
Update README.md (#8824)
dismad Sep 3, 2024
80332fe
ref(docker): use cache mounts for build cache (#8796)
gustavovalverde Sep 5, 2024
98fc607
build(deps): bump tj-actions/changed-files in the devops group (#8835)
dependabot[bot] Sep 5, 2024
96fd240
fix clippy lints (#8855)
oxarbitrage Sep 6, 2024
4b907f6
feat(rpc): Add a `stop` rpc method (#8839)
oxarbitrage Sep 9, 2024
aa9ef63
feat(rpc): Add a `generate` rpc method (#8849)
oxarbitrage Sep 9, 2024
8436b96
feat(rpc): Add more fields to `getmininginfo` call (#8860)
oxarbitrage Sep 18, 2024
9bd70ed
build(deps): bump tj-actions/changed-files in the devops group (#8874)
dependabot[bot] Sep 18, 2024
d34e3b1
fix(rpc): modify shutdown used in `stop()` (#8863)
oxarbitrage Sep 18, 2024
2cd463e
ref(ci): consolidate cached states workflows and scripts (#8865)
gustavovalverde Sep 19, 2024
64f37a1
feat(cd): deploy instances with attached cached states (#8868)
gustavovalverde Sep 19, 2024
0c23cca
chore(docker): remove debugging output by default (#8870)
gustavovalverde Sep 19, 2024
845009a
feat(tests): Move the RPC tests framework from zcashd (#8866)
oxarbitrage Sep 20, 2024
71d9911
Returns an error instead of panicking when the relevant chain is empt…
arya2 Sep 23, 2024
1ea85e7
feat(ci): add Docker Scout vulnerabilities scanning (#8871)
gustavovalverde Sep 24, 2024
87f3e0d
build(deps): bump docker/scout-action in the devops group (#8890)
dependabot[bot] Oct 1, 2024
7d599b3
fix(actions): disk regeneration does not required a cached state (#8…
gustavovalverde Oct 4, 2024
1343bc9
build(deps): bump the devops group with 4 updates (#8905)
dependabot[bot] Oct 7, 2024
e55dfcc
build(deps): bump the prod group across 1 directory with 24 updates (…
dependabot[bot] Oct 7, 2024
84a5929
Responds with a maximum of 160 block headers (#8913)
arya2 Oct 7, 2024
40d2105
Updates post-NU6 funding stream address for FPF on Mainnet (#8914)
arya2 Oct 7, 2024
4a02248
Update docker-compose.yml - tiny typo (#8893)
skyl Oct 7, 2024
d1266d6
build(deps): bump the devops group with 3 updates (#8919)
dependabot[bot] Oct 10, 2024
e262dda
upgrade checkpoints (#8924)
oxarbitrage Oct 10, 2024
d2cc365
build(deps): Upgrade ECC crates for Zebra `v2.0.0-rc.0` release cand…
oxarbitrage Oct 10, 2024
e37072a
feat(regtest): Add regtest halving interval and port test (#8888)
oxarbitrage Oct 10, 2024
196c80b
Fixes a panic (#8928)
arya2 Oct 10, 2024
5c12ab9
Release Zebra (`v2.0.0-rc.0`) (#8927)
oxarbitrage Oct 11, 2024
23b6d81
Disable GCP/Firebase/Docker/deploy related workflows (add .disabled s…
dmidem Oct 29, 2024
562afaf
Prepare to use Orchard ZSA
dmidem Jul 29, 2024
a464d90
Add basic CI checks workflow
dmidem Sep 3, 2024
7fd8ec3
Fix ci-basic.yml
dmidem Sep 3, 2024
cdd8bdc
Fix ci-basic.yml (2)
dmidem Sep 3, 2024
092d34d
Add installing of build-essential to ci-basic.yml
dmidem Sep 3, 2024
9f8b67f
Try to use librocksdb-dev in ci-basic.yml
dmidem Sep 3, 2024
fbd553e
Run ci-basic.yml on ubuntu-24.04
dmidem Sep 3, 2024
af26006
Enable nu6 cfg flag in ci-basic.yml
dmidem Sep 3, 2024
23a5f8a
Adjust the code with librustzcash/zcash_protocol nu6 related changes
dmidem Sep 4, 2024
5a6721c
Add RUSTDOCFLAGS to ci-basic.yml
dmidem Sep 4, 2024
8adb3f6
Set Rust cfg zcash_unstable to nu6 in .cargo/config.toml
dmidem Oct 29, 2024
fce103d
Sync with halo2 changes
dmidem Oct 29, 2024
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
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Flags that apply to all Zebra crates and configurations
[target.'cfg(all())']
rustflags = [
# FIXME: Consider removing this line later (it's needed for the ZSA version of librustzcash crates)
"--cfg", "zcash_unstable=\"nu6\"",

# Zebra standard lints for Rust 1.65+

# High-risk code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,26 @@ on:
type: boolean
default: false

# TODO: Temporarily disabled to reduce network load, see #6894.
#push:
# # Skip main branch updates where Rust code and dependencies aren't modified.
# branches:
# - main
# paths:
# # code and tests
# - '**/*.rs'
# # hard-coded checkpoints and proptest regressions
# - '**/*.txt'
# # dependencies
# - '**/Cargo.toml'
# - '**/Cargo.lock'
# # configuration files
# - '.cargo/config.toml'
# - '**/clippy.toml'
# # workflow definitions
# - 'docker/**'
# - '.dockerignore'
# - '.github/workflows/cd-deploy-nodes-gcp.yml'
# - '.github/workflows/sub-build-docker-image.yml'
push:
# Skip main branch updates where Rust code and dependencies aren't modified.
branches:
- main
paths:
# code and tests
- '**/*.rs'
# hard-coded checkpoints and proptest regressions
- '**/*.txt'
# dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# configuration files
- '.cargo/config.toml'
- '**/clippy.toml'
# workflow definitions
- 'docker/**'
- '.dockerignore'
- '.github/workflows/cd-deploy-nodes-gcp.yml'
- '.github/workflows/sub-build-docker-image.yml'

# Only runs the Docker image tests, doesn't deploy any instances
pull_request:
Expand Down Expand Up @@ -176,6 +175,19 @@ jobs:
test_variables: '-e NETWORK -e ZEBRA_CONF_PATH="zebrad/tests/common/configs/v1.0.0-rc.2.toml"'
network: ${{ inputs.network || vars.ZCASH_NETWORK }}

# Finds a `tip` cached state disk for zebra from the main branch
#
# Passes the disk name to subsequent jobs using `cached_disk_name` output
#
get-disk-name:
name: Get disk name
uses: ./.github/workflows/sub-find-cached-disks.yml
with:
network: ${{ inputs.network || vars.ZCASH_NETWORK }}
disk_prefix: zebrad-cache
disk_suffix: tip
prefer_main_cached_state: true

# Deploy Managed Instance Groups (MiGs) for Mainnet and Testnet,
# with one node in the configured GCP region.
#
Expand All @@ -196,16 +208,18 @@ jobs:
matrix:
network: [Mainnet, Testnet]
name: Deploy ${{ matrix.network }} nodes
needs: [ build, versioning, test-configuration-file, test-zebra-conf-path ]
needs: [ build, versioning, test-configuration-file, test-zebra-conf-path, get-disk-name ]
runs-on: ubuntu-latest
timeout-minutes: 60
env:
CACHED_DISK_NAME: ${{ needs.get-disk-name.outputs.cached_disk_name }}
permissions:
contents: 'read'
id-token: 'write'
if: ${{ !cancelled() && !failure() && ((github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'release') }}

steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false

Expand All @@ -228,7 +242,7 @@ jobs:
# Setup gcloud CLI
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected].5
uses: google-github-actions/[email protected].6
with:
workload_identity_provider: '${{ vars.GCP_WIF }}'
service_account: '${{ vars.GCP_DEPLOYMENTS_SA }}'
Expand All @@ -240,24 +254,31 @@ jobs:
# but the implementation is failing as it's requiring the disk names, contrary to what is stated in the official documentation
- name: Create instance template for ${{ matrix.network }}
run: |
NAME="zebrad-cache-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}"
DISK_PARAMS="name=${NAME},device-name=${NAME},size=400GB,type=pd-ssd"
if [ -n "${{ env.CACHED_DISK_NAME }}" ]; then
DISK_PARAMS+=",image=${{ env.CACHED_DISK_NAME }}"
else
echo "No cached disk found for ${{ matrix.network }} in main branch"
exit 1
fi
gcloud compute instance-templates create-with-container zebrad-${{ needs.versioning.outputs.major_version || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK} \
--boot-disk-size 300GB \
--machine-type ${{ vars.GCP_SMALL_MACHINE }} \
--boot-disk-size 50GB \
--boot-disk-type=pd-ssd \
--image-project=cos-cloud \
--image-family=cos-stable \
--user-output-enabled \
--metadata google-logging-enabled=true,google-logging-use-fluentbit=true,google-monitoring-enabled=true \
--network-interface=subnet=${{ vars.GCP_SUBNETWORK }} \
--create-disk="${DISK_PARAMS}" \
--container-mount-disk=mount-path='/var/cache/zebrad-cache',name=${NAME},mode=rw \
--container-stdin \
--container-tty \
--container-image ${{ vars.GAR_BASE }}/zebrad@${{ needs.build.outputs.image_digest }} \
--container-env "NETWORK=${{ matrix.network }},LOG_FILE=${{ vars.CD_LOG_FILE }},LOG_COLOR=false,SENTRY_DSN=${{ vars.SENTRY_DSN }}" \
--create-disk=name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${NETWORK},device-name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${NETWORK},auto-delete=yes,size=300GB,type=pd-ssd,mode=rw \
--container-mount-disk=mount-path='/var/cache/zebrad-cache',name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${NETWORK},mode=rw \
--machine-type ${{ vars.GCP_SMALL_MACHINE }} \
--network-interface=subnet=${{ vars.GCP_SUBNETWORK }} \
--service-account ${{ vars.GCP_DEPLOYMENTS_SA }} \
--scopes cloud-platform \
--labels=app=zebrad,environment=prod,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \
--metadata google-logging-enabled=true,google-logging-use-fluentbit=true,google-monitoring-enabled=true \
--labels=app=zebrad,environment=staging,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \
--tags zebrad

# Check if our destination instance group exists already
Expand Down Expand Up @@ -297,16 +318,18 @@ jobs:
# Note: this instances are not automatically replaced or deleted
deploy-instance:
name: Deploy single ${{ inputs.network }} instance
needs: [ build, test-configuration-file, test-zebra-conf-path ]
needs: [ build, test-configuration-file, test-zebra-conf-path, get-disk-name ]
runs-on: ubuntu-latest
timeout-minutes: 30
env:
CACHED_DISK_NAME: ${{ needs.get-disk-name.outputs.cached_disk_name }}
permissions:
contents: 'read'
id-token: 'write'
if: github.event_name == 'workflow_dispatch'

steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false

Expand All @@ -329,7 +352,7 @@ jobs:
# Setup gcloud CLI
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected].5
uses: google-github-actions/[email protected].6
with:
workload_identity_provider: '${{ vars.GCP_WIF }}'
service_account: '${{ vars.GCP_DEPLOYMENTS_SA }}'
Expand All @@ -340,22 +363,30 @@ jobs:
# Create instance template from container image
- name: Manual deploy of a single ${{ inputs.network }} instance running zebrad
run: |
NAME="zebrad-cache-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}"
DISK_PARAMS="name=${NAME},device-name=${NAME},size=400GB,type=pd-ssd"
if [ -n "${{ env.CACHED_DISK_NAME }}" ]; then
DISK_PARAMS+=",image=${{ env.CACHED_DISK_NAME }}"
else
echo "No cached disk found for ${{ matrix.network }} in main branch"
exit 1
fi
gcloud compute instances create-with-container "zebrad-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}" \
--boot-disk-size 300GB \
--machine-type ${{ vars.GCP_SMALL_MACHINE }} \
--boot-disk-size 50GB \
--boot-disk-type=pd-ssd \
--image-project=cos-cloud \
--image-family=cos-stable \
--user-output-enabled \
--metadata google-logging-enabled=true,google-logging-use-fluentbit=true,google-monitoring-enabled=true \
--network-interface=subnet=${{ vars.GCP_SUBNETWORK }} \
--create-disk="${DISK_PARAMS}" \
--container-mount-disk=mount-path='/var/cache/zebrad-cache',name=${NAME},mode=rw \
--container-stdin \
--container-tty \
--container-image ${{ vars.GAR_BASE }}/zebrad@${{ needs.build.outputs.image_digest }} \
--container-env "NETWORK=${{ inputs.network }},LOG_FILE=${{ inputs.log_file }},LOG_COLOR=false,SENTRY_DSN=${{ vars.SENTRY_DSN }}" \
--create-disk=name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${NETWORK},device-name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${NETWORK},auto-delete=yes,size=300GB,type=pd-ssd,mode=rw \
--container-mount-disk=mount-path='/var/cache/zebrad-cache',name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${NETWORK},mode=rw \
--machine-type ${{ vars.GCP_SMALL_MACHINE }} \
--network-interface=subnet=${{ vars.GCP_SUBNETWORK }} \
--service-account ${{ vars.GCP_DEPLOYMENTS_SA }} \
--scopes cloud-platform \
--metadata google-logging-enabled=true,google-monitoring-enabled=true \
--labels=app=zebrad,environment=qa,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \
--tags zebrad \
--zone ${{ vars.GCP_ZONE }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ jobs:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false

# Setup gcloud CLI
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected].5
uses: google-github-actions/[email protected].6
with:
workload_identity_provider: '${{ vars.GCP_WIF }}'
service_account: '${{ vars.GCP_DEPLOYMENTS_SA }}'
Expand Down Expand Up @@ -106,14 +106,14 @@ jobs:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false

# Setup gcloud CLI
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected].5
uses: google-github-actions/[email protected].6
with:
workload_identity_provider: '${{ vars.GCP_WIF }}'
service_account: '${{ vars.GCP_DEPLOYMENTS_SA }}'
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/ci-basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Basic checks

#on: [push, pull_request]
on: [push]

jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04]

env:
# Use system-installed RocksDB library instead of building from scratch
ROCKSDB_LIB_DIR: /usr/lib
# Use system-installed Snappy library for compression in RocksDB
SNAPPY_LIB_DIR: /usr/lib/x86_64-linux-gnu
# Enable the `nu6` feature in `zcash_protocol`
RUSTFLAGS: '--cfg zcash_unstable="nu6"'
RUSTDOCFLAGS: '--cfg zcash_unstable="nu6"'

steps:
- uses: actions/checkout@v4
- name: Install dependencies on Ubuntu
#run: sudo apt-get update && sudo apt-get install -y protobuf-compiler build-essential librocksdb-dev
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler librocksdb-dev
- name: Run tests
run: cargo test --verbose
- name: Verify working directory is clean
run: git diff --exit-code
- name: Run doc check
run: cargo doc --all-features --document-private-items
- name: Run format check
run: cargo fmt -- --check
2 changes: 1 addition & 1 deletion .github/workflows/ci-build-crates.patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1

# Setup Rust with stable toolchain and minimal profile
- name: Setup Rust
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-build-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
- uses: r7kamura/[email protected]

# Setup Rust with stable toolchain and minimal profile
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}

steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false
- uses: r7kamura/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
runs-on: ubuntu-latest-xl

steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false

Expand Down Expand Up @@ -103,4 +103,4 @@ jobs:
run: cargo llvm-cov --lcov --no-run --output-path lcov.info

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4.6.0
14 changes: 7 additions & 7 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ jobs:
rust: ${{ steps.changed-files-rust.outputs.any_changed == 'true' }}
workflows: ${{ steps.changed-files-workflows.outputs.any_changed == 'true' }}
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false
fetch-depth: 0

- name: Rust files
id: changed-files-rust
uses: tj-actions/[email protected].0
uses: tj-actions/[email protected].3
with:
files: |
**/*.rs
Expand All @@ -56,7 +56,7 @@ jobs:

- name: Workflow files
id: changed-files-workflows
uses: tj-actions/[email protected].0
uses: tj-actions/[email protected].3
with:
files: |
.github/workflows/*.yml
Expand All @@ -69,7 +69,7 @@ jobs:
if: ${{ needs.changed-files.outputs.rust == 'true' }}

steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false

Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
if: ${{ needs.changed-files.outputs.rust == 'true' }}

steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
with:
persist-credentials: false
- uses: r7kamura/[email protected]
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
needs: changed-files
if: ${{ needs.changed-files.outputs.workflows == 'true' }}
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
- name: actionlint
uses: reviewdog/[email protected]
with:
Expand All @@ -166,7 +166,7 @@ jobs:
runs-on: ubuntu-latest
needs: changed-files
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
- uses: codespell-project/[email protected]
with:
only_warn: 1
Expand Down
Loading