Remove the sapling params from the published Rust crate, and download them from GitHub at build time #3951
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
crates.io currently does not allow crates bigger than 10 MB. Our
ironfish
crate is currently almost 90 MB due to the fact that the sapling params are shipped together with the crate. Due to this limitation, it is not possible to publish ourironfish
crate with the sapling params included in it. This PR reduces the crate size from 90 MB to 48 KB.This PR makes the sapling params optional, and excludes them from the Rust crate to be published on crates.io (or other Cargo registries). When the sapling params are not present, they are fetched from GitHub, more specifically from the
master
branch of theiron-fish/ironfish
repository. The integrity of sapling param files is checked using their SHA-512 hash.The build experience for people using the Git repository does not change (no files are downloaded).
The runtime experience is the same for people using the Git repository or using the Cargo crate (the resulting binary is the same).
Alternatives considered
Future improvements
Fetch files from *.ironfish.network instead of GitHub.
Testing Plan
Trying to build the crate from the Git repository should not download any file:
(No warnings displayed)
Trying to build the crate without the sapling params should result in the files to be downloaded:
(Warnings displayed)
Multiple builds should not re-run the build script:
(Second run did not download anything despite the warnings, and was much faster)
Changing the checksum fail should make the build fail:
Checking the crate package size:
Documentation
No
Breaking Change
Not a breaking change