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

refactor: move network validation to GetFullNodeAPIV1Curio #345

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Winter-Soren
Copy link

This PR implements network validation at the API connection level to prevent mismatched network connections early in the startup process.

Changes:

  1. Removed separate network validation function and use existing build.BuildTypeString()
  2. Moved network validation from run.go to GetFullNodeAPIV1Curio()
  3. Added validation for each chain node with proper error handling and logging
  4. Only proceeds if at least one compatible node is found

Fixes #340

Copy link
Contributor

@LexLuthr LexLuthr left a comment

Choose a reason for hiding this comment

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

I think cleanup from previous approach is pending.

build/params.go Outdated Show resolved Hide resolved
cmd/curio/run.go Outdated Show resolved Hide resolved
deps/apiinfo.go Show resolved Hide resolved
deps/apiinfo.go Outdated Show resolved Hide resolved
Copy link
Contributor

@LexLuthr LexLuthr left a comment

Choose a reason for hiding this comment

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

Looks good. Just need 1 last change.

cmd/curio/run.go Outdated Show resolved Hide resolved
@LexLuthr
Copy link
Contributor

LexLuthr commented Jan 6, 2025

@Winter-Soren Can you please run make gen in the curio repo? It should fix the failing test. It might complaint about missing dependencies, please install those.

@LexLuthr
Copy link
Contributor

@Winter-Soren Follow up on last message. Can you please finish the PR so we can merge this?

Copy link
Contributor

@LexLuthr LexLuthr left a comment

Choose a reason for hiding this comment

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

Please make the following changed to fix the conflict.

cmd/curio/run.go Outdated
@@ -135,7 +135,7 @@ var runCmd = &cli.Command{
return xerrors.Errorf("starting market RPCs: %w", err)
}

err = rpc.ListenAndServe(ctx, dependencies, shutdownChan) // Monitor for shutdown.
err = rpc.ListenAndServe(ctx, dependencies, shutdownChan)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
err = rpc.ListenAndServe(ctx, dependencies, shutdownChan)
err = rpc.ListenAndServe(ctx, dependencies, shutdownChan) // Monitor for shutdown.

deps/apiinfo.go Outdated
@@ -22,6 +22,7 @@ import (
lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
cliutil "github.com/filecoin-project/lotus/cli/util"
"github.com/filecoin-project/lotus/build"
Copy link
Contributor

Choose a reason for hiding this comment

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

You should use the build package from Curio here.
"github.com/filecoin-project/curio/build"

Copy link
Author

@Winter-Soren Winter-Soren Jan 13, 2025

Choose a reason for hiding this comment

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

Sure, I will proceed ahead!

@Winter-Soren
Copy link
Author

@LexLuthr as suggested I have added the build package "github.com/filecoin-project/curio/build" in apiinfo.go
but its still failing.

@LexLuthr
Copy link
Contributor

@Winter-Soren https://app.circleci.com/pipelines/github/filecoin-project/curio/1566/workflows/bfbb7f65-b38a-4802-b754-0f0d3bfa6352/jobs/13668 will tell you why test are not passing. We group the go dependencies. Just run make fix-imports and commit the changes. It should fix the test.

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.

Refuse to start if binary network doesn't match chain node network
2 participants