gno icon indicating copy to clipboard operation
gno copied to clipboard

feat: add `gnoland init`

Open zivkovicmilos opened this issue 1 year ago • 11 comments

Description

This PR introduces a gnoland init command, that initializes the node configuration and secrets.

Closes #1885

Contributors' checklist...
  • [x] Added new tests, or not needed, or not feasible
  • [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • [x] Updated the official documentation or not needed
  • [x] No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • [x] Added references to related issues and PRs
  • [ ] Provided any useful hints for running manual tests
  • [ ] Added new benchmarks to generated graphs, if any. More info here.

zivkovicmilos avatar Apr 25 '24 17:04 zivkovicmilos

Codecov Report

Attention: Patch coverage is 56.97674% with 74 lines in your changes are missing coverage. Please review.

Project coverage is 45.87%. Comparing base (bb776f0) to head (fb8bb39).

Files Patch % Lines
gno.land/cmd/gnoland/start.go 60.43% 24 Missing and 12 partials :warning:
gno.land/pkg/gnoland/app.go 0.00% 18 Missing :warning:
tm2/pkg/bft/config/config.go 0.00% 14 Missing and 2 partials :warning:
gno.land/cmd/gnoland/config_init.go 85.71% 1 Missing and 1 partial :warning:
tm2/pkg/bft/config/toml.go 0.00% 0 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1985      +/-   ##
==========================================
- Coverage   49.08%   45.87%   -3.21%     
==========================================
  Files         576      521      -55     
  Lines       77806    72445    -5361     
==========================================
- Hits        38191    33236    -4955     
+ Misses      36521    36466      -55     
+ Partials     3094     2743     -351     
Flag Coverage Δ
contribs/gnodev ?
contribs/gnofaucet ?
contribs/gnokeykc ?
contribs/gnomd ?
gno.land 61.62% <63.39%> (+0.24%) :arrow_up:
gnovm ?
misc/autocounterd 0.00% <ø> (ø)
misc/genproto 0.00% <ø> (ø)
misc/genstd 73.90% <ø> (ø)
misc/goscan 0.00% <ø> (ø)
misc/logos 17.38% <ø> (ø)
misc/loop 0.00% <ø> (ø)
tm2 54.47% <0.00%> (-0.05%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 25 '24 17:04 codecov[bot]

Relates/addresses/continues: #1050, #1102, #1333, #1605.

moul avatar Apr 26 '24 08:04 moul

Before we continue, I'd like to clarify a few points.

Could you please specify the expected behavior and update docs/?

How does gnoland start function in different contexts?

@moul Do you think we should start adding the command docs in this PR, or leave it for #1820?

gnoland init is supposed to initialize the node's secrets and config directory (default) in the given data dir. It currently overlaps with gnoland start, because we still have lazy init functionality in gnoland start (something that will get dropped in #1886).

It is however completely backwards compatible with users that still use only gnoland start (until #1886)

zivkovicmilos avatar Apr 26 '24 11:04 zivkovicmilos

Do you think we should start adding the command docs in this PR, or leave it for https://github.com/gnolang/gno/issues/1820?

Any addition of a subcommand in an official tool should include documentation updates in the same pull request.

gnoland init is supposed to initialize the node's secrets and config directory (default) in the given data dir. It currently overlaps with gnoland start, because we still have lazy init functionality in gnoland start (something that will get dropped in https://github.com/gnolang/gno/issues/1886).

OK, thx.

It is however completely backwards compatible with users that still use only gnoland start (until https://github.com/gnolang/gno/issues/1886)

Ok, great. Please wait for a discussion before starting #1886.

moul avatar Apr 26 '24 13:04 moul

@moul @leohhhn

I've added the initial gnoland init documentation:

6575bf8

I've also noticed that our gnoland tooling documentation is completely outdated, so we have created a task for tackling this in a separate PR: https://github.com/gnolang/gno/issues/1987

Here is what the docs page looks like:

Screenshot 2024-04-26 at 17-59-33 gnoland Gno land Documentation

zivkovicmilos avatar Apr 26 '24 16:04 zivkovicmilos

Could you place "init" before "start" in the gnoland -h command?

Ensure that the documentation begins with a suggested flow, starting with "init" and then "start," rather than delving into technical details and parameters right away.

Your documentation is well-written, but it focuses on advanced scenarios. We should prioritize having essential documentation come first.

moul avatar Apr 26 '24 18:04 moul

@moul

Could you place "init" before "start" in the gnoland -h command?

I was under the impression that ffcli sorts the subcommands alphabetically for whatever reason (regardless of how we add subcommands), but that thankfully isn't the case, so I've swapped the order:

5005dc0

Ensure that the documentation begins with a suggested flow, starting with "init" and then "start," rather than delving into technical details and parameters right away.

Your documentation is well-written, but it focuses on advanced scenarios. We should prioritize having essential documentation come first.

Are you suggesting I add something additional to the gnoland binary reference page, or create a new tutorial that utilizes gnoland init and gnoland start?

We will fill out the gnoland binary page with much more additional content in a PR that tackles #1987

zivkovicmilos avatar Apr 28 '24 16:04 zivkovicmilos

I recommend focusing on documenting workflows. We should ensure including gnoland --help output in an advanced section using an automated tool. The main documentation gap is tool usage and getting started, which should be human-written.

Consider renaming your page to "Start a Gnoland Node" for clarity. Begin with a simple case and progress to advanced cases later, if needed.

moul avatar Apr 29 '24 09:04 moul

@moul @leohhhn

I've updated the existing node start documentation to include the changes applied in this PR (as well as the new flow): 3bc320f

I noticed a small bug in InitChainer, so I fixed it as well in this commit

For more detailed docs, I will leave it to #1820

zivkovicmilos avatar May 08 '24 10:05 zivkovicmilos

Just took code overview, seems nice ( I'm testing with actual binary now ).

Found one small minor thing, which is -skip-start flag with gnoland start. I think it can be remove it as we discussed from here since gnoland init does init.

r3v4s avatar May 09 '24 01:05 r3v4s

Status of this PR:

  • I need to drop skip-startas pointed out by @r3v4s, I completely forgot about this 🤦‍♂️
  • @moul needs to take a look at the docs in this PR and give feedback :)

zivkovicmilos avatar May 13 '24 08:05 zivkovicmilos