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

WIP: tm2 clean up #825

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/gnoland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- gnokey
- gnoweb
- gnofaucet
- gnotxsync
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tm2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
go-version: [ "1.19.x", "1.20.x" ]
goarch: [ "amd64" ]
goos: [ "linux" ]
program: [ "./cmd/tm2txsync", "./pkg/amino/cmd/aminoscan", "./pkg/amino/cmd/goscan", "./pkg/autofile/cmd", "./pkg/iavl/cmd/iaviewer" ]
program: [ "./pkg/amino/cmd/aminoscan", "./pkg/amino/cmd/goscan", "./pkg/autofile/cmd", "./pkg/iavl/cmd/iaviewer" ]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN go build -o ./build/gnokey ./gno.land/cmd/gnokey
RUN go build -o ./build/gnofaucet ./gno.land/cmd/gnofaucet
RUN go build -o ./build/gnoweb ./gno.land/cmd/gnoweb
RUN go build -o ./build/gno ./gnovm/cmd/gno
RUN go build -o ./build/tm2txsync ./tm2/cmd/tm2txsync
RUN go build -o ./build/gnotxsync ./gno.land/cmd/gnotxsync
RUN ls -la ./build
ADD . /opt/gno/src/
RUN rm -rf /opt/gno/src/.git
Expand Down Expand Up @@ -42,9 +42,9 @@ COPY --from=build /opt/build/build/gnofaucet /opt/gno/bin/
ENTRYPOINT ["gnofaucet"]
EXPOSE 5050

FROM runtime-tls AS tm2txsync-slim
COPY --from=build /opt/build/build/tm2txsync /opt/gno/bin/
ENTRYPOINT ["tm2txsync"]
FROM runtime-tls AS gnotxsync-slim
COPY --from=build /opt/build/build/gnotxsync /opt/gno/bin/
ENTRYPOINT ["gnotxsync"]

FROM runtime-tls AS gnoweb-slim
COPY --from=build /opt/build/build/gnoweb /opt/gno/bin/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Also, see the [quickstart guide](https://test3.gno.land/r/demo/boards:testboard/
Developer commands:

* [gno](./gnovm/cmd/gno) - handy tool for developing gno packages & realms
* [tm2txsync](./tm2/cmd/tm2txsync) - importing/exporting transactions from local blockchain node storage
* [gnotxsync](./tm2/cmd/gnotxsync) - importing/exporting transactions from local blockchain node storage
* [goscan](./misc/goscan) - dumps imports from specified file’s AST
* [genproto](./misc/genproto) - helper for generating .proto implementations
* [gnofaucet](./gno.land/cmd/gnofaucet) - serves GNOT faucet
Expand Down
3 changes: 2 additions & 1 deletion gno.land/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ help:
rundep=go run -modfile ../misc/devdeps/go.mod

.PHONY: build
build: build.gnoland build.gnokey build.gnoweb build.gnofaucet
build: build.gnoland build.gnokey build.gnoweb build.gnofaucet _build.gnotxsync

build.gnoland:; go build -o build/gnoland ./cmd/gnoland
build.gnoweb:; go build -o build/gnoweb ./cmd/gnoweb
build.gnofaucet:; go build -o build/gnofaucet ./cmd/gnofaucet
build.gnokey:; go build -o build/gnokey ./cmd/gnokey
_build.gnotxsync:; go build -o build/gnotxsync ./cmd/gnotxsync
Comment on lines +9 to +15
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
build: build.gnoland build.gnokey build.gnoweb build.gnofaucet _build.gnotxsync
build.gnoland:; go build -o build/gnoland ./cmd/gnoland
build.gnoweb:; go build -o build/gnoweb ./cmd/gnoweb
build.gnofaucet:; go build -o build/gnofaucet ./cmd/gnofaucet
build.gnokey:; go build -o build/gnokey ./cmd/gnokey
_build.gnotxsync:; go build -o build/gnotxsync ./cmd/gnotxsync
build: build.gnoland build.gnokey build.gnoweb build.gnofaucet build.gnotxsync
build.gnoland:; go build -o build/gnoland ./cmd/gnoland
build.gnoweb:; go build -o build/gnoweb ./cmd/gnoweb
build.gnofaucet:; go build -o build/gnofaucet ./cmd/gnofaucet
build.gnokey:; go build -o build/gnokey ./cmd/gnokey
build.gnotxsync:; go build -o build/gnotxsync ./cmd/gnotxsync


.PHONY: install
install: install.gnoland install.gnoweb install.gnofaucet install.gnokey
Expand Down
2 changes: 1 addition & 1 deletion gno.land/cmd/gnoland/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/gnolang/gno/tm2/pkg/crypto"
"github.com/gnolang/gno/tm2/pkg/log"
osm "github.com/gnolang/gno/tm2/pkg/os"
vmm "github.com/gnolang/gno/tm2/pkg/sdk/vm"
vmm "github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

_ "github.com/gnolang/gno/tm2/pkg/sdk/auth" // XXX better way?
_ "github.com/gnolang/gno/tm2/pkg/sdk/bank"
_ "github.com/gnolang/gno/tm2/pkg/sdk/vm"
_ "github.com/gnolang/gno/gno.land/pkg/sdk/vm"
)

type exportCfg struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

_ "github.com/gnolang/gno/tm2/pkg/sdk/auth" // XXX better way?
_ "github.com/gnolang/gno/tm2/pkg/sdk/bank"
_ "github.com/gnolang/gno/tm2/pkg/sdk/vm"
_ "github.com/gnolang/gno/gno.land/pkg/sdk/vm"
)

type importCfg struct {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion gno.land/cmd/gnoweb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/gotuna/gotuna"

"github.com/gnolang/gno/gno.land/cmd/gnoweb/static" // for static files
"github.com/gnolang/gno/tm2/pkg/sdk/vm" // for error types
"github.com/gnolang/gno/gno.land/pkg/sdk/vm" // for error types
// "github.com/gnolang/gno/tm2/pkg/sdk" // for baseapp (info, status)
)

Expand Down
2 changes: 1 addition & 1 deletion gno.land/pkg/gnoland/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/gnolang/gno/tm2/pkg/sdk"
"github.com/gnolang/gno/tm2/pkg/sdk/auth"
"github.com/gnolang/gno/tm2/pkg/sdk/bank"
"github.com/gnolang/gno/tm2/pkg/sdk/vm"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/gno/tm2/pkg/store"
"github.com/gnolang/gno/tm2/pkg/store/dbadapter"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var Package = amino.RegisterPackage(amino.NewPackage(
"github.com/gnolang/gno/tm2/pkg/sdk/vm",
"github.com/gnolang/gno/gno.land/pkg/sdk/vm",
"vm",
amino.GetCallersDirname(),
).WithDependencies(
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tm2/pkg/sdk/vm/vm.proto → gno.land/pkg/sdk/vm/vm.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package vm;

option go_package = "github.com/gnolang/gno/tm2/pkg/sdk/vm/pb";
option go_package = "github.com/gnolang/gno/gno.land/pkg/sdk/vm/pb";

// imports
import "github.com/gnolang/gno/tm2/pkg/std/std.proto";
Expand Down
2 changes: 1 addition & 1 deletion misc/docker-integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/amino"
"github.com/gnolang/gno/tm2/pkg/sdk/vm"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
Expand Down
2 changes: 1 addition & 1 deletion misc/genproto/genproto.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/gnolang/gno/tm2/pkg/crypto/multisig"
"github.com/gnolang/gno/tm2/pkg/sdk"
"github.com/gnolang/gno/tm2/pkg/sdk/bank"
"github.com/gnolang/gno/tm2/pkg/sdk/vm"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
)

Expand Down
2 changes: 0 additions & 2 deletions tm2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ help:
rundep=go run -modfile ../misc/devdeps/go.mod

.PHONY: build
build: _build.tm2txsync
_build.tools: _build.aminoscan _build.goscan _build.logjack _build.iaviewer

_build.tm2txsync:; go build -o build/tm2txsync ./cmd/tm2txsync
_build.aminoscan:; go build -o build/aminoscan ./pkg/amino/cmd/aminoscan
_build.goscan:; go build -o build/goscan ./pkg/amino/cmd/goscan
_build.logjack:; go build -o build/logjack ./pkg/autofile/cmd
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/crypto/keys/client/addpkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"flag"
"fmt"

"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
Copy link
Member

@moul moul Jul 31, 2023

Choose a reason for hiding this comment

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

addpkg should be defined in gno.land or gnovm, not tm2.

Copy link
Contributor

@tbruyelle tbruyelle Aug 1, 2023

Choose a reason for hiding this comment

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

It appears there's many shared struct between the different commands, so moving only call.go and addpkg.go in gno.land/cmd/gnokey is not straightforward.

What about moving the whole tm2/pkg/crypto/keys/client folder into gno.land/cmd/gnokey/client ? I tested and it requires only a few changes in some imports:

-	"github.com/gnolang/gno/tm2/pkg/crypto/keys/client"
+	"github.com/gnolang/gno/gno.land/cmd/gnokey/client"

tm2/pkg/crypto/keys/client is not used at all inside tm2.

Copy link
Member

Choose a reason for hiding this comment

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

I believe it's a smart approach: let's start by moving to gno.land and then take the time to design well-crafted reusable components in the right place for future blockchains.

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 have the right to push to this repo, but I can provide the patch, even if the change is pretty straighforward.

Copy link
Contributor Author

@piux2 piux2 Aug 1, 2023

Choose a reason for hiding this comment

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

The tm2/pkg/crypto/keys/client is part of the generic tm2 tool set. We should not remove it from the tm2 folder. The purpose of the separation is that people can create other tools using tm2 packages in addition to gnokey

Copy link
Contributor

@tbruyelle tbruyelle Aug 1, 2023

Choose a reason for hiding this comment

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

Not really generic if I may: one of the first thing it does is fetching the config from $GNO_HOME or $XDG_CONFIG_HOME/gno.

But I understand your point, it would be better to add the addpkg and call subcommands in the gnokey package. I just feel it's a shame to keep this ultimate dependency.

The other way maybe is to simply turn public the related structs (makeTxCfg, queryCfg) and methods (signAndBroadcast, queryHandler, ...) . At some point, to make this package more flexible, that makes sense.

gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
"github.com/gnolang/gno/tm2/pkg/amino"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
"github.com/gnolang/gno/tm2/pkg/errors"
"github.com/gnolang/gno/tm2/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
)

Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/crypto/keys/client/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"flag"
"fmt"

"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
Copy link
Member

Choose a reason for hiding this comment

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

same for call, should be defined in gno.land on gnovm, but not tm2.

"github.com/gnolang/gno/tm2/pkg/amino"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
"github.com/gnolang/gno/tm2/pkg/errors"
"github.com/gnolang/gno/tm2/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
)

Expand Down