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

Step1: Integrate ZSA-compatible crates into Zebra while maintaining original Orchard (Vanilla) support for now [to upstream] #7

Closed
wants to merge 39 commits into from

Conversation

dmidem
Copy link

@dmidem dmidem commented Aug 21, 2024

This draft PR updates Zebra to use QED-it's ZSA-compatible versions of the following crates:

  • halo2
  • zcash_note_encryption
  • spling-crypto
  • orchard
  • Crates from the libruszcash repository:
    • zcash_primitives
    • zcash_protocol
    • zcash_address
    • zcash_encoding
    • zcash_history
    • zcash_client_backend

These version of the crates are backward-compatible and support both the current Orchard (Vanilla) protocol and the upcoming ZSA variation.

This PR maintains support for the existing Orchard protocol only, without yet enabling or integrating ZSA-specific features!

@dmidem dmidem requested a review from PaulLaux August 21, 2024 08:48
@PaulLaux PaulLaux changed the title Integrate ZSA-compatible crates into Zebra while maintaining original Orchard (Vanilla) support for now [to upstream] Integrate ZSA-compatible crates into Zebra while maintaining original Orchard (Vanilla) support for now Aug 29, 2024
@PaulLaux PaulLaux changed the base branch from main to zsa1 August 29, 2024 08:20
gustavovalverde and others added 23 commits August 29, 2024 19:57
…ndation#8817)

* fix(docker): allow the `zebra` user access to relevant dirs

When runnning a Zebra node using Docker without a privileged user, you won't be able to modify some files and directories, not even the ones in the current directory, as the `zebra` user has no permission to `/`.

The best way to solve this is making the `/opt/zebrad` the current `WORKDIR`. This also requires moving the `entrypoint.sh` from the root `/` directory to `/etc/zebrad` as this directory is used to save configuration, and other files.

An `APP_HOME` ARG is used as not all platforms where a Docker container is deployed allows writting permissions to the `/opt` directory. This allow some users to re-build the image with a custom `WORKDIR`

* fix(docker): allow starting the container without a `zebrad` command

As `gosu` is just required and available in our `runtime` image, trying to run `docker run -it --rm  --name tests -t zfnd/zebra:<pr> /bin/bash` in other stages will fail, as `gosu` is not available.
… a rare panic (ZcashFoundation#8795)

* Splits `atomic_write_to_tmp_file` out of `zebra_network::Config::update_peer_cache`

* Uses the new `atomic_write_to_tmp_file` fn in `update_peer_cache()`

* Replaces repetitive code for getting the default peer and state cache directories with `default_cache_dir()`

* Converts `atomic_write_to_tmp_file` to a blocking function and adds `spawn_atomic_write_to_tmp_file` for use in async environments.

* Uses `atomic_write_to_tmp_file` to write database versions to disk

* Removes `spawn_atomic_write_to_tmp_file()` and inlines its body at its callsite to avoid adding tokio as a dependency of zebra-chain.

* Apply suggestions from code review

Co-authored-by: Marek <[email protected]>

---------

Co-authored-by: Marek <[email protected]>
…thod (ZcashFoundation#8788)

* Adds a mempool request to wait for a transaction verification result and uses it in `sendrawtransaction` RPC method

* removes unnecessary clone

* fix clippy warnings

* returns verification errors for all `mempool::Queue` requests, removes `QueueRpc` request variant

* returns oneshot channel in mempool::Response::Queue

* updates a test vector to check for download or verification error in mempool::response::Queued result receiver

* Always require tokio as a dependency in zebra-node-services

* checks for closed channel errors in sendrawtransaction and updates a prop test to check that verification errors are propagated correctly
* Use `serde_yml` instead of `serde_yaml`

* Regenerate `openapi.yaml`
* clean-up: Remove outdated note

* Add minimal hardware requirements

Source & credit: https://x.com/Zerodartz/status/1811460885996798159

* Apply suggestions from code review

Co-authored-by: Arya <[email protected]>

---------

Co-authored-by: Arya <[email protected]>
Co-authored-by: Pili Guerra <[email protected]>
* ref(docker): leverage cache mount with bind mounts

This update eliminates the need for external tools like `cargo-chef` to leverage caching layers, resulting in an average build time reduction of 4m30s (~36% improvement).

While this solution doesn't fully resolve the issues mentioned in ZcashFoundation#6169 (comment), it represents the best possible approach without resorting to custom solutions, which we'd prefer to avoid.

* chore: remove extra `WORKDIR` and imp comments

* chore: improve comment legibility

Co-authored-by: Arya <[email protected]>

---------

Co-authored-by: Pili Guerra <[email protected]>
Co-authored-by: Arya <[email protected]>
…Foundation#8835)

Bumps the devops group with 1 update: [tj-actions/changed-files](https://github.com/tj-actions/changed-files).


Updates `tj-actions/changed-files` from 45.0.0 to 45.0.1
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v45.0.0...v45.0.1)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: devops
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* add a `stop` rpc method

* add todo comment

* add a ticket number to the TODO

Co-authored-by: Marek <[email protected]>

---------

Co-authored-by: Marek <[email protected]>
Co-authored-by: Pili Guerra <[email protected]>
* implement `generate` rpc method

* update openapi

---------

Co-authored-by: Pili Guerra <[email protected]>
oxarbitrage and others added 13 commits September 18, 2024 11:05
)

* add additional fields to getmininginfo

* update openapi spec

* fix zebra-state standalone build

* make sure fields are not present when tip is 0
…Foundation#8874)

Bumps the devops group with 1 update: [tj-actions/changed-files](https://github.com/tj-actions/changed-files).


Updates `tj-actions/changed-files` from 45.0.1 to 45.0.2
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v45.0.1...v45.0.2)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: devops
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* modify shutdown used in `stop()`

* use conditional compilation

* add note

* fix conditional compilation
…tion#8865)

* ref(ci): consolidate cached states workflows and scripts

We've been using multiple approaches to locate and retrieve cached states in GCP. However, this has made it difficult to reuse the same methods across new workflows or different scenarios.

To address this, we've streamlined the process to make it more reusable in other contexts. This change will support deploying instances from both the `main` branch and `release`, simplifying future implementations and speeding up the process.

Changes:
- Use a single bash script (`gcp-get-cached-disks.sh`) to get cached states names and availability
- Move script logic from `sub-find-cached-disks.yml` to `gcp-get-cached-disks.sh` and adapt `sub-find-cached-disks.yml` to allow to output available disks and disks names.
- Simplify parameters usage in `sub-deploy-integration-tests-gcp.yml` and convert the `Find ${{ inputs.test_id }} cached state disk` step into an independent job, to be able to use the `sub-find-cached-disks.yml` reusable workflow
- Remove repetition in `sub-ci-integration-tests-gcp.yml`

* ref(tests): Use the `ZEBRA_CACHED_STATE_DIR` env var across tests

We had a technical debt with some tests using a hardcoded value for the cache directory (`/zebrad-cache`), which generated inconsistency across disks and cached states directories.

Changes:
- Allow sync tests to use the `ZEBRA_CACHED_STATE_DIR` as the cache directory, if specified
- Update the `entrypoint.sh` to reflect this change
- Add the `ZEBRA_CACHED_STATE_DIR` variable to the missing tests in `sub-ci-integration-tests-gcp.yml`, and remove extra parameters to call reusable workflows.
…on#8868)

* ref(ci): consolidate cached states workflows and scripts

We've been using multiple approaches to locate and retrieve cached states in GCP. However, this has made it difficult to reuse the same methods across new workflows or different scenarios.

To address this, we've streamlined the process to make it more reusable in other contexts. This change will support deploying instances from both the `main` branch and `release`, simplifying future implementations and speeding up the process.

Changes:
- Use a single bash script (`gcp-get-cached-disks.sh`) to get cached states names and availability
- Move script logic from `sub-find-cached-disks.yml` to `gcp-get-cached-disks.sh` and adapt `sub-find-cached-disks.yml` to allow to output available disks and disks names.
- Simplify parameters usage in `sub-deploy-integration-tests-gcp.yml` and convert the `Find ${{ inputs.test_id }} cached state disk` step into an independent job, to be able to use the `sub-find-cached-disks.yml` reusable workflow
- Remove repetition in `sub-ci-integration-tests-gcp.yml`

* ref(tests): Use the `ZEBRA_CACHED_STATE_DIR` env var across tests

We had a technical debt with some tests using a hardcoded value for the cache directory (`/zebrad-cache`), which generated inconsistency across disks and cached states directories.

Changes:
- Allow sync tests to use the `ZEBRA_CACHED_STATE_DIR` as the cache directory, if specified
- Update the `entrypoint.sh` to reflect this change
- Add the `ZEBRA_CACHED_STATE_DIR` variable to the missing tests in `sub-ci-integration-tests-gcp.yml`, and remove extra parameters to call reusable workflows.

* feat(cd): deploy instances with cached states

* fix(cd): allow deploying from branch

* fix(cd): add missing `CACHED_DISK_NAME` env
…n#8866)

* move the rpc-tests framework from zcashd

* ignore pycache

* remove all tests from the list except getmininginfo

* iimprove a bit the readme

* change some env variable names

* add cache, add reindex test

* fix the paralell framework

* fix env variables

* change tests order

* update docs with env variable name change

* fix binary location

* reduce base config

* restore env var

* ignore stderr in the output
…8871)

* feat(ci): add Docker Scout vulnerabilities scanning

* fix(scout): add missing `environment` command

Co-authored-by: Marek <[email protected]>

---------

Co-authored-by: Marek <[email protected]>
…ation#8890)

Bumps the devops group with 1 update: [docker/scout-action](https://github.com/docker/scout-action).


Updates `docker/scout-action` from 1.13.0 to 1.14.0
- [Release notes](https://github.com/docker/scout-action/releases)
- [Commits](docker/scout-action@v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: docker/scout-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: devops
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@PaulLaux PaulLaux changed the title [to upstream] Integrate ZSA-compatible crates into Zebra while maintaining original Orchard (Vanilla) support for now Integrate ZSA-compatible crates into Zebra while maintaining original Orchard (Vanilla) support for now [to upstream] Oct 14, 2024
@dmidem dmidem changed the title Integrate ZSA-compatible crates into Zebra while maintaining original Orchard (Vanilla) support for now [to upstream] Step1: Integrate ZSA-compatible crates into Zebra while maintaining original Orchard (Vanilla) support for now [to upstream] Oct 17, 2024
@dmidem dmidem closed this Oct 17, 2024
@dmidem dmidem deleted the switch-to-zsa-crates-nu6 branch October 17, 2024 07:55
@dmidem
Copy link
Author

dmidem commented Oct 17, 2024

Closed in favour of #14 due to the branch renaming.

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.

6 participants