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: remove gnovm and gno.land dependencies from tm2 #1483

Merged
merged 17 commits into from
Jan 15, 2024

Conversation

gfanton
Copy link
Member

@gfanton gfanton commented Dec 21, 2023

This PR shares the same goal as #1438: to make tm2 completely unaware of gnovm and gno.land. However, it adopts a different strategy to achieve this, following #1438 (comment). It will:

  • Exposed almost everything from the tm2/crypto/keys/client package:
    • NewCommandXXX, along with their specific structure configurations and fields, are now exposed to allow the creation of composable CLI tools.
    • XXXHandler (including Sign, Verify, Broadcast, etc.) are now exposed to enable external packages to reuse some logic from the keys/client package.
  • Moved specific gnovm/gno.land commands to the gnokey package: run, call, and addpkg.
  • In an effort to avoid duplicate code, an ExecSignAndBroadcast method has been exposed. However, it appears too specific, and I am considering duplicating it regardless. I would appreciate thoughts on this.
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.

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
@gfanton gfanton requested review from jaekwon, moul and a team as code owners December 21, 2023 23:46
@github-actions github-actions bot added 📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Dec 21, 2023
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (82c89ce) 55.85% compared to head (cc506ef) 55.91%.

Files Patch % Lines
gno.land/cmd/gnokey/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1483      +/-   ##
==========================================
+ Coverage   55.85%   55.91%   +0.06%     
==========================================
  Files         431      431              
  Lines       65839    65684     -155     
==========================================
- Hits        36773    36727      -46     
+ Misses      26185    26081     -104     
+ Partials     2881     2876       -5     
Flag Coverage Δ
go-1.21.x ∅ <ø> (∅)
misc ∅ <ø> (∅)
misc-_test.genstd ∅ <ø> (∅)

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.

…tegration

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Comment on lines 3 to 4
// TODO: move most of the logic in ROOT/gno.land/...

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// TODO: move most of the logic in ROOT/gno.land/...

@@ -0,0 +1,140 @@
package keyscli
Copy link
Member

Choose a reason for hiding this comment

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

please, add a small readme explaining the goal of this package and its relationships and add a link to this PR.


import (
"context"
"flag"
"fmt"
"io/ioutil"
ioutil "io"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ioutil "io"
"io"

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't use io because it will make me rename 'io' argument from commands.IO

Copy link
Member

Choose a reason for hiding this comment

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

do rename that one ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

done !

@@ -1,222 +0,0 @@
package client
Copy link
Member

Choose a reason for hiding this comment

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

The file is marked as deleted, but it was actually moved and then modified. We want to preserve the file's history. To handle the rename and edit, we can make two commits or explore other options. cc @harry-hov.

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, from an history point view, it's correctly mark as renamed in the commit: 32511b3
but since this PR will be squash when merge, im not sure we can do anything about it...

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
@thehowl
Copy link
Member

thehowl commented Jan 7, 2024

🤯 the pr number is an anagram of the old #1438

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Looks great 💯

Thank you for going through with the split 🙏

In an effort to avoid duplicate code, an ExecSignAndBroadcast method has been exposed. However, it appears too specific, and I am considering duplicating it regardless. I would appreciate thoughts on this.

This is honestly one of the sketchier parts of gnokey, the entire sign / broadcast pipeline. I like the approach you've gone with for now, I think it's out of the scope of this PR to fix these flows (that affect a good chunk of gnokey commands).

tm2/pkg/crypto/keys/client/maketx.go Show resolved Hide resolved
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
@moul moul merged commit 5ad12cd into gnolang:master Jan 15, 2024
67 of 71 checks passed
gfanton added a commit to moul/gno that referenced this pull request Jan 18, 2024
This PR shares the same goal as gnolang#1438: to make `tm2` completely unaware
of `gnovm` and `gno.land`. However, it adopts a different strategy to
achieve this, following
gnolang#1438 (comment). It
will:
- Exposed almost everything from the `tm2/crypto/keys/client` package:
- `NewCommandXXX`, along with their specific structure configurations
and fields, are now exposed to allow the creation of composable CLI
tools.
- `XXXHandler` (including Sign, Verify, Broadcast, etc.) are now exposed
to enable external packages to reuse some logic from the `keys/client`
package.
- Moved specific `gnovm`/`gno.land` commands to the `gnokey` package:
`run`, `call`, and `addpkg`.
- In an effort to avoid duplicate code, an `ExecSignAndBroadcast` method
has been exposed. However, it appears too specific, and I am considering
duplicating it regardless. I would appreciate thoughts on this.




<details><summary>Contributors' checklist...</summary>

- [ ] 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](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
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: No status
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants