-
Notifications
You must be signed in to change notification settings - Fork 375
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 tm2/keys/client
into gno.land/pkg/keyscli
#1438
Conversation
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>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1438 +/- ##
==========================================
- Coverage 55.85% 47.07% -8.79%
==========================================
Files 431 366 -65
Lines 65729 60615 -5114
==========================================
- Hits 36713 28534 -8179
- Misses 26140 29727 +3587
+ Partials 2876 2354 -522
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
tm2/keys/client
in gno.land/pkg/keyscli
tm2/keys/client
into gno.land/pkg/keyscli
Please add a README.md file in the tm2/crypto/keys/client/ folder to explain that this folder is currently not in use anymore but will be in the future again, once we have gained experience with the package. Include a link to this PR and the related issue. As a bonus, consider adding a .go file that raises a deprecation error with the new specified path if someone attempts to import the old path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me 🥇
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>
Please open an issue before or after merging so that we can track the creation of a new generic later. |
A first generic part that could be moved/kept in tm2 is the low-level query/message engine. It can easily be done in iterations; and also make keys/client (CLI) importing another library that is purely the low level client but not managing any password reading for instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it 🚀
@gfanton Please add in the description of the PR that this PR contains breaking functionality 🙏
func NewRootCmd(io commands.IO) *commands.Command { | ||
panic("NewRootCmd: has been deprecated, use `gno.land/pkg/keycli` instead") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should drop this entirely instead of leaving the API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, leaving a portion of the API here will ultimately lead to either duplicate code or the necessity to expose parts of the client that were not intended to be exposed.
Personally, I would prefer relocating this specific client to gno.land
(so it's not removed, just moved elsewhere) and exposing a more generic library here. This library could serve as a versatile tool that can power gnokey
or any other tool, not limited to just CLI tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid using deprecated methods and instead opt for a compilation-time approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this: https://github.com/quic-go/quic-go/pull/3364/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gfanton attempted it and shared a screenshot of the outcome, which unfortunately didn't meet our expectations.
Let's proceed by removing the .go file and retaining only the README.md file; this approach should suffice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It kind of works, but the issue is that it will leave a permanent error in the code, not just on import. This is especially problematic for tools like golangci-lint
and gopls
, so it's not suitable for us.
tm2/keys/client
into gno.land/pkg/keyscli
tm2/keys/client
into gno.land/pkg/keyscli
tm2/keys/client
into gno.land/pkg/keyscli
tm2/keys/client
into gno.land/pkg/keyscli
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
tm2/keys/client
into gno.land/pkg/keyscli
tm2/keys/client
into gno.land/pkg/keyscli
So, way forward agreed with Jae:
|
150c8d2
to
243b1f1
Compare
Closing in favor of #1483 |
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. <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>
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>
This PR implements the strategy discussed in Issue #1174 on the gnolang/gno repository and moves the
tm2/keys/client
package togno.land/pkg/keyscli
. The main goal is to maketm2
completely unaware ofgnovm
andgno.land
.This will be a two-step process: starting with the removal of the client from
tm2
, and later maximizing shared code as needed.EDIT: it will also enable golang workspace setup: preview
BREAKING CHANGE: client package is now moved inside gno.land/pkg/keyscli
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description