Skip to content

feat: improve lotus-gateway build for network selection #12969

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

Closed
wants to merge 2 commits into from

Conversation

rjan90
Copy link
Contributor

@rjan90 rjan90 commented Mar 20, 2025

Related Issues

Closes #12967 #12767

Proposed Changes

  • Add a marker file .calibnet-mode that gets created when running make calibnet
  • Make lotus-gateway check for that markerfile
    • If the file exists, it builds with calibnet tags
    • If the file doesn’t exist, it builds for mainnet
  • Make sure the marker file gets removed when running make clean

Additional Info

We discussed other approaches as well, but we wanted to keep current state intact and not add lotus-gateway to make calibnet since it is already overloaded, as having to build extra binaries is not ideal. And additionally we wanted to keep consistency, and prefer to build lotus-gateway instead of introducing a special lotus-gateway-calib.

Checklist

Before you mark the PR ready for review, please make sure that:

rjan90 added 2 commits March 20, 2025 08:21
feat: improve lotus-gateway build for network selection
chore: update changelog
@github-project-automation github-project-automation bot moved this to 📌 Triage in FilOz Mar 20, 2025
@rjan90
Copy link
Contributor Author

rjan90 commented Mar 20, 2025

Testing it:

  • Running make calibnet I can see that there is now a marker file:
ls -la | grep .calibnet-mode
-rw-rw-r--  1 filoz filoz         0 Mar 20 07:24 .calibnet-mode
  • Running make lotus-gateway now outputs which tags its building lotus-gateway with:
make lotus-gateway
rm -f lotus-gateway
Building lotus-gateway with calibnet tags
go: downloading golang.org/x/time v0.11.0 
  • Checking version:
./lotus-gateway -h
NAME:
   lotus-gateway - Public API server for lotus

USAGE:
   lotus-gateway [global options] command [command options]

VERSION:
   1.32.1-dev+calibnet+git.d2be3a825
  • Running make clean to see if things get cleaned up properly:
make clean
rm -rf build/.filecoin-install build/.update-modules lotus lotus-miner lotus-worker lotus-shed lotus-gateway lotus-seed lotus-fountain lotus-bench lotus-stats lotus-pcr lotus-health lotus-wallet lotus-keygen testground tvx lotus-sim .calibnet-mode
make -C extern/filecoin-ffi/ clean
make[1]: Entering directory '/mnt/nvmeraid0/lotus/extern/filecoin-ffi'
go clean -cache -testcache
rm -rf filcrypto.h filcrypto.pc libfilcrypto.a .install-filcrypto
rm -f ./runner
cd rust && cargo clean && cd ..
     Removed 0 files
make[1]: Leaving directory '/mnt/nvmeraid0/lotus/extern/filecoin-ffi'
------
ls -la | grep .calibnet-mode

And I can see that there is no .calibnet-mode marker file there anymore.

@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting Review in FilOz Mar 20, 2025
@rjan90 rjan90 self-assigned this Mar 20, 2025
@BigLep BigLep requested a review from rvagg March 20, 2025 21:40
@BigLep
Copy link
Member

BigLep commented Mar 20, 2025

Requested review from @rvagg given he was the opener of the issues being fixed.

@rvagg
Copy link
Member

rvagg commented Mar 21, 2025

I don't love this because of the marker file - which creates persistent and surprising state that's going to cause unintended consequences later (it also needs to be in .gitignore so nobody accidentally commits it). Ideally, the Makefile's state only persists for its execution lifetime and the remaining state comes from source files. Marker files being a last resort if you can't detect some state information about your source.

Anyway, after a few rounds with my mate Claude, we arrived at an alternative approach: #12972 - what do you think about that one instead?

@rjan90
Copy link
Contributor Author

rjan90 commented Mar 21, 2025

Closing in favour of #12972

@rjan90 rjan90 closed this Mar 21, 2025
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting Review to 🎉 Done in FilOz Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

Makefile target to build calibnet version of lotus-gateway
3 participants