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

feat: overhaul lazy init in gnoland start #1985

Merged
merged 21 commits into from
May 26, 2024

Conversation

zivkovicmilos
Copy link
Member

@zivkovicmilos zivkovicmilos commented Apr 25, 2024

Description

This PR started as an implementation of the gnoland init command, that initializes the node configuration and secrets, as part of #1885.

However, throughout the lifetime of this PR, discussions with @moul have shaped the PR to take a different approach:

  • gnoland init, because it's an alias, does not warrant its own subcommand (it's a combo of gnoland config init and gnoland secrets init
  • gnoland start should have a much more clear lazy init flow, and it should be optional (I added this with the --lazy flag). Here is an example of the flow:
    • Screenshot 2024-05-14 at 14 42 15
  • documentation that was initially done for gnoland init is adapted to use the gnoland config and the gnoland secrets command suites (this was easy to do, they are an alias)
  • Lazy initialized secrets and files now show up with a WARN label in the CLI
  • I've updated the init logic for secrets, so that it supports partial initialization, since the original gnoland start lazy init regenerated everything that was missing and skipped everything that was present. Partial initialization means that missing secrets are regenerated, and existing ones are skipped
  • I've dropped a few useless flags for gnoland start, with more to be pruned in future PRs. These were legacy / leftover, as we've added better support for them in the meantime

As a consequence of these discussions, we have decided to table lazy init removal for the future -- #1886

Closes #1885

Thank you @albttx, @r3v4s, and the team for discussions that led us to finalize this bigger effort of node init flows 🙏

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • 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 zivkovicmilos added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Apr 25, 2024
@zivkovicmilos zivkovicmilos self-assigned this Apr 25, 2024
@github-actions github-actions bot added the 📦 🌐 tendermint v2 Issues or PRs tm2 related label Apr 25, 2024
Copy link

codecov bot commented Apr 25, 2024

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 ⚠️
gno.land/pkg/gnoland/app.go 0.00% 18 Missing ⚠️
tm2/pkg/bft/config/config.go 0.00% 14 Missing and 2 partials ⚠️
gno.land/cmd/gnoland/config_init.go 85.71% 1 Missing and 1 partial ⚠️
tm2/pkg/bft/config/toml.go 0.00% 0 Missing and 2 partials ⚠️
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%) ⬆️
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%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@moul
Copy link
Member

moul commented Apr 26, 2024

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

Copy link
Member

@moul moul left a comment

Choose a reason for hiding this comment

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

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?

@zivkovicmilos
Copy link
Member Author

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)

@moul
Copy link
Member

moul commented Apr 26, 2024

Do you think we should start adding the command docs in this PR, or leave it for #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 #1886).

OK, thx.

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

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

@zivkovicmilos zivkovicmilos requested a review from a team as a code owner April 26, 2024 16:00
@zivkovicmilos
Copy link
Member Author

@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:
#1987

Here is what the docs page looks like:

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

@zivkovicmilos zivkovicmilos requested a review from moul April 26, 2024 16:03
@moul
Copy link
Member

moul commented Apr 26, 2024

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.

gno.land/cmd/gnoland/init.go Outdated Show resolved Hide resolved
@zivkovicmilos
Copy link
Member Author

@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

@moul
Copy link
Member

moul commented Apr 29, 2024

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.

@r3v4s
Copy link
Contributor

r3v4s commented May 9, 2024

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.

Copy link
Contributor

@leohhhn leohhhn left a comment

Choose a reason for hiding this comment

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

I took a look at the tutorial and ran through commands locally, everything seems to be working and is understandable.

This tutorial is aimed at people who want to run validators and connect to a network.

We are moving away from having a local node setup tutorial in the Getting Started section, as this section should appeal to people interested in Gno development (for which they will use gno, gnokey, and gnodev), instead of a full local node setup. This PR, which shows how the Getting Started section will look like, has been sitting for some time now awaiting to be merged.

I will approve of this PR, but can you please make a new section in the docs, called “Gno Infra” where this tutorial can live along side other infra tutorials (such as the ones upcoming from OnBloc, as well as the tx-indexer, tx-archive, etc.)? Also, please add the new section to sidebars.js file in the docs repo. 🙏

@zivkovicmilos
Copy link
Member Author

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 zivkovicmilos marked this pull request as draft May 13, 2024 13:36
@zivkovicmilos zivkovicmilos changed the title feat: add gnoland init feat: overhaul lazy init in gnoland start May 14, 2024
@zivkovicmilos zivkovicmilos requested review from moul and ajnavarro May 14, 2024 12:52
@zivkovicmilos zivkovicmilos marked this pull request as ready for review May 14, 2024 12:58
@zivkovicmilos zivkovicmilos requested a review from a team as a code owner May 26, 2024 05:36
@zivkovicmilos zivkovicmilos merged commit 0a1e732 into gnolang:master May 26, 2024
63 of 64 checks passed
@zivkovicmilos zivkovicmilos deleted the feat/gnoland-init branch May 26, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related
Projects
Status: Done
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

[chain] Add the gnoland init command
6 participants