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

proofs api refactor #4177

Merged
merged 3 commits into from
Apr 12, 2024
Merged

proofs api refactor #4177

merged 3 commits into from
Apr 12, 2024

Conversation

LesnyRumcajs
Copy link
Member

@LesnyRumcajs LesnyRumcajs commented Apr 10, 2024

Summary of changes

Changes introduced in this pull request:

  • refactored the proofs API module a bit, which includes:
    • separating the files, logically
    • adjusting visibility
    • adding docs (and adjusting current ones to reflect reality) - addressing @aatifsyed remark
    • adding tests where the logic was more than trivial
    • code-golfing

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner April 10, 2024 13:35
@LesnyRumcajs LesnyRumcajs requested review from hanabi1224 and aatifsyed and removed request for a team April 10, 2024 13:35
@LesnyRumcajs LesnyRumcajs force-pushed the refactor-proofs-api branch 2 times, most recently from caa81b3 to 5bba381 Compare April 10, 2024 13:46
documentation/src/environment_variables.md Show resolved Hide resolved
src/utils/proofs_api/parameters.rs Outdated Show resolved Hide resolved
src/utils/proofs_api/parameters.rs Outdated Show resolved Hide resolved
const DIR_ENV: &str = "FIL_PROOFS_PARAMETER_CACHE";
const GATEWAY_ENV: &str = "IPFS_GATEWAY";
const TRUST_PARAMS_ENV: &str = "TRUST_PARAMS";
const IPFS_GATEWAY_ENV: &str = "IPFS_GATEWAY";
Copy link
Contributor

@hanabi1224 hanabi1224 Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth mentioning in doc somewhere
https://lotus.filecoin.io/kb/nodes-in-china/

Running Lotus requires the download of chain’s proof parameters which are large files which by default are hosted outside of China and very slow to download there. To get around that, users should set the following environment variable when running either of lotus, lotus-miner and lotus-worker:

export IPFS_GATEWAY=https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance I feel we should prefix the environment variable with FOREST_ but in this case maybe it's more convenient to re-use the lotus one. They don't prefix it with LOTUS_ for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit hesitant to change the variable names to avoid breaking changes, but better do it now than later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance I feel we should prefix the environment variable with FOREST_ but in this case maybe it's more convenient to re-use the lotus one. They don't prefix it with LOTUS_ for some reason.

Agreed on the prefix. As stated above - it would be nice to have some sort of tool that would allow us to specify the prefix for everything we load. Then we can load variables with and without the prefix.

Copy link
Member Author

@LesnyRumcajs LesnyRumcajs Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hanabi1224 Great point there, I was not aware of that. On top of that, I was able to find a bug (not sure how long it was there, I guess pretty long) where the IPFS_GATEWAY was not overridable - the environment variable only changed what was logged. 🤡 See a4c53c5

@ruseinov ruseinov self-requested a review April 12, 2024 07:19
@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Apr 12, 2024
Merged via the queue into main with commit 18c5f26 Apr 12, 2024
27 checks passed
@LesnyRumcajs LesnyRumcajs deleted the refactor-proofs-api branch April 12, 2024 08:56
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.

4 participants