Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
initializeSapling
to avoid cloning
The Sapling parameters defined in `ironfish::sapling_bls12::SAPLING` are behind a `lazy_static`. As such, the parameters are not loaded until accessed fo the first time. The purpose of `initializeSapling` is to acccess the parameters to ensure that they get loaded early. The current implementation of `initializeSapling` was calling `.clone()` on `ironfish::sapling_bls12::SAPLING`, causing large amounts of memory to be allocated and written, only to be discarded shortly afterwards. The implementation has been changed to just dereference `SAPLING`, without doing anything else. This is enough to trigger `lazy_static` to load the parameters. Also: - Removed the `Arc` from `ironfish::sapling_bls12::SAPLING`: `Arc` is used to extend lifetimes in multithreaded environments, but the lifetime of `SAPLING` is static, so there's no point in extending it. - Removed `ironfish::sapling_bls12::load` because it's not public and redundant
- Loading branch information