Skip to content

[nild] Argument --chain adds test/main-net defaults #813

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 1 commit into from

Conversation

dmtrskv
Copy link
Contributor

@dmtrskv dmtrskv commented Apr 15, 2025

Short Summary

An archive node outside of the cluster will be run simply with nild archive --chain devnet.

The PR is a draft until the relay is up.

What Changes Were Made

  • Argument --chain in nild and default config depending on it.
  • Defaults for the actual network: relay and bootstrap addresses. WIP: now on test cluster --chain test.
  • Validation of cluster spec against the defaults in nild gen-configs with --chain. E.g., each bootstrap identity and each relay from the defaults must be present in the cluster configs.

Related Issue

Fixes #786

Future Tasks

More defaults, including zero state.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a --chain argument to the nild command to allow chain-specific default configurations for archive and network nodes, while adding validations in generating devnet clusters.

  • Added chain-specific default settings and validations in defaults.go and defaults_test.go
  • Extended configuration loading and devnet generation with relay validations and the new chain flag support
  • Updated helper functions in internal network and cobrax packages to support chain-related parameters

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
nil/services/nilservice/defaults_test.go Added tests for chain-specific default validations
nil/services/nilservice/defaults.go Introduced default configurations for testnet and mainnet
nil/internal/network/addr_info.go Added function for constructing AddrInfoSlice from strings
nil/internal/collate/syncer.go Added NodeVersion.String method for debug/log output
nil/internal/cobrax/config.go Added chain flag and getter functions
nil/cmd/nild/main.go Integrated chain flag in configuration loading
nil/cmd/nild/devnet.go Updated devnet generation with relay validation and chain-specific config

ChainNameMainnet = "mainnet"
)

type ChainDefaults struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really understand how we're going to maintain this. As far as I understand it, in devnet (where is it by the way? We don't have testnet or mainnet right now, and they are the only ones represented here) we drop the configuration from time to time and validator identities can change. In that sense, I don't think a static hardcode is going to help us. Plus there's a chance of getting a chicken and egg problem when we're preparing a release in which we plan to deploy a new configuration, and we don't yet know the identifiers that we want to zip into the nild version we'll be releasing.

Why don't we put a method in the JSON-RPC API that will output actual validator addresses that can be used as bootstrapPeers? Then we could make a command that takes an RPC URL, goes to it, and gets the actual values. This would work for any deployments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll have to hard-code the url then. And also somehow guarantee that the service was not compromised.
libp2p guarantees identity verification and also allows to connect to the network without any mediators like RPC.
Here we have just a short list of peers that will be used by the bootstrap. I reduced it to the single archive node in a follow-up push (I don't think that we want to open validator nodes right away).

We won't use this on dev, I suppose.
And on prod we're not supposed to clear network keys a lot. (I doubt that we clear them regularly on dev either.)

I'm using nil-dev for tests now.
I'll leave devnet (or testnet?) probably in the end if that's how our chain is known to the public.

Copy link
Contributor

Choose a reason for hiding this comment

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

First, let's synchronize in terminology. As I understand it,
mainnet — not present
testnet — not present
devnet == nil-prod
🤷‍♂️ == nil-dev
Do you understand these terms in the same way?

How justified is it to worry about JSON-RPC being compromised? We have HTTPS there. If we assume the user will download nild from our site and trust it, why shouldn't they trust another HTTPS request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the chain names.

Concerning the RPC, let's discuss on Thursday.
Also, we can always change this solution to RPC later.

@dmtrskv
Copy link
Contributor Author

dmtrskv commented Apr 24, 2025

Will be implemented in a different fashion

@dmtrskv dmtrskv closed this Apr 24, 2025
@dmtrskv dmtrskv deleted the nild-defaults branch April 24, 2025 19:48
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.

Easy node startup
2 participants