Skip to content

Avoid use of Vec in ZSA-compatible version of lib.rs#3

Merged
dmidem merged 1 commit intozsa1from
avoid_vec_usage
Apr 17, 2024
Merged

Avoid use of Vec in ZSA-compatible version of lib.rs#3
dmidem merged 1 commit intozsa1from
avoid_vec_usage

Conversation

@dmidem
Copy link

@dmidem dmidem commented Dec 19, 2023

Problem

The current CI build for this zcash_note_encryption crate is failing when attempting to merge ZSA-related changes made in lib.rs. This issue arises from the use of Vec generic defined in the standard library ("std"), while the crate is configured with the #![no_std] directive in lib.rs.

Current solution

To address the CI build failure, a temporary solution has been implemented by modifying the GitHub Actions CI configuration (ci.yml) to enable the "alloc" feature. Since "alloc" also contains the definition of Vec and can serve as a lightweight alternative to "std," this adjustment allows the CI to complete successfully.

ci.yml:

...
        run: cargo build --features=alloc --no-default-features --verbose --target ${{ matrix.target }}
...

While this approach resolves the immediate CI issue, it introduces additional dependencies. This may not be optimal, especially for scenarios involving the usage of zcash_note_encryption in embedded solutions or on the browser side.

Proposed slternative solution

An alternative solution is presented in this draft pull request, involving modifications to the lib.rs file to eliminate the use of Vec. It's important to note that this alternative solution requires corresponding adjustments in the orchard_zsa crate, which implements the Domain trait from zcash_note_encryption.

@dmidem dmidem merged commit 8b6b31d into zsa1 Apr 17, 2024
@PaulLaux PaulLaux changed the title Draft: an alternative solution to resolve CI build failure due to the use of Vec in ZSA-compatible version of lib.rs Avoid use of Vec in ZSA-compatible version of lib.rs Apr 17, 2024
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.

2 participants