Skip to content

Commit

Permalink
refactor: tm2 clean up against the latest main branch (#1080)
Browse files Browse the repository at this point in the history
<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Original text from #825</summary>
<p>

# Description
Part of #692 #585 

BREAKING CHANGE: In GitHub Action Flow, the build script needs to be
updated on moving tm2txsync from tm2/cmd to gno.land/cmd

## gno.land/ 

It provides information and tools necessary for running gno.land node.
It includes
- a node application for starting gnoland nodes to deliver an RPC
endpoint
- gnoweb for web access to the chain. 
- tools to interact with gno nodes.
- a cosmos SDK gno VM module with keeper and handler.

In the future, we plan to consolidate tools for node deployment and
monitoring. The future plan also includes supporting both IBC and ICS.

## gnovm/ 

Gnovm is agnostic to any SDK or chain.

It is intended for gno contract developers and gno VM developers. It
includes
- a gno development CLI
- gnolang language
- virtual machine implementation.
- standard libraries for gno contracts, 
- examples and test cases.

Future plans include making gnovm compatible with IBC

## tm2/ 

Tendermint2 is a BFT consensus engine and a set of tools for blockchain
builders

More details can be found at 

[https://github.com/tendermint/tendermint2#readme](https://github.com/tendermint/tendermint2#readme)


In the future, tm2 plans to:

- Remain synchronized with the tendermint2 repository.
- Port issue fixes between Tendermint v0.23.4 and v0.34.
- Ensure compatibility with IBC and ABCI2.

# The dependences among tm2, gnovm and gno.land

- gno.land depends on tm2 and gnovm
- gnovm depends on tm2 
- tm2 is independent to gnovm and gno.land

```mermaid

flowchart LR
    A[gno.land]--> B[gnovm] --> C[tm2]
    A --> C

```

# Discussion

## client commands 

We aim to establish a clear dependency structure between these
components as outlined earlier.

Ideally we'd like to have clear dependency between these components as
listed above

At present, tm2/pkg/crypto/keys/client/root.go is dependent on
gno.land/pkg/sdk/vm.
We're considering moving the following commands to gno.land/cmd/gnokey/
and eliminating the newMakeTxCmd() from cmd.AddSubCommands() in
tm2/pkg/crypto/client/root.go:

- addpkg.go
- call.go
- send.go
- maketx.go 

However, these files rely on the private config structure and private
methods defined in tm2/pkg/crypto/keys/client/. Until we decide the next
steps, these files will remain in tm2, which means that tm2/ continues
to depend on gno.lang/ for now.

## genproto

As for the genproto, we need to decide where misc/genproto/genproto.go
should be placed.

## sample tendermint2 program

Since we've moved out applications that depend on gno in tm2, we need to
consider whether we should reintroduce the sample tendermint application
or create a new one.

[tendermint classic
main.go](https://github.com/tendermint/classic/tree/master/cmd/tendermint)

</p>
</details> 

<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>

---------

Co-authored-by: piux2 <>
Co-authored-by: Manfred Touron <[email protected]>
  • Loading branch information
piux2 and moul authored Aug 31, 2023
1 parent 236c112 commit 64f0fd0
Show file tree
Hide file tree
Showing 31 changed files with 25 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gnoland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- gnokey
- gnoweb
- gnofaucet
- gnotxsync
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tm2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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 All @@ -44,7 +44,6 @@ jobs:
- _test.pkg.amino
- _test.pkg.bft
- _test.pkg.others
- _test.cmds
runs-on: ubuntu-latest
timeout-minutes: 15
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://github.com/gnolang/gno/blob/master/exam
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](./gno.land/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
6 changes: 4 additions & 2 deletions gno.land/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@ 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

.PHONY: install
install: install.gnoland install.gnoweb install.gnofaucet install.gnokey
install: install.gnoland install.gnoweb install.gnofaucet install.gnokey install.gnotxsync

install.gnoland:; go install ./cmd/gnoland
install.gnoweb:; go install ./cmd/gnoweb
install.gnofaucet:; go install ./cmd/gnofaucet
install.gnokey:; go install ./cmd/gnokey
install.gnotxsync:; go install ./cmd/gnotxsync

.PHONY: fclean
fclean: clean
Expand Down
2 changes: 1 addition & 1 deletion gno.land/cmd/gnoland/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/gnolang/gno/gno.land/pkg/gnoland"
vmm "github.com/gnolang/gno/gno.land/pkg/sdk/vm"
gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
"github.com/gnolang/gno/gnovm/pkg/gnomod"
"github.com/gnolang/gno/tm2/pkg/amino"
Expand All @@ -21,7 +22,6 @@ 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"
"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 @@ -15,9 +15,9 @@ import (
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/std"

_ "github.com/gnolang/gno/gno.land/pkg/sdk/vm"
_ "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"
)

type exportCfg struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/gnolang/gno/tm2/pkg/errors"
"github.com/gnolang/gno/tm2/pkg/std"

_ "github.com/gnolang/gno/gno.land/pkg/sdk/vm"
_ "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"
)

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 @@ -5,6 +5,7 @@ import (
"path/filepath"
"strings"

"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/amino"
abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types"
"github.com/gnolang/gno/tm2/pkg/crypto"
Expand All @@ -13,7 +14,6 @@ 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/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.
4 changes: 2 additions & 2 deletions 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 All @@ -28,4 +28,4 @@ message InvalidStmtError {
}

message InvalidExprError {
}
}
2 changes: 1 addition & 1 deletion misc/docker-integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"time"

"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/amino"
"github.com/gnolang/gno/tm2/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 @@ -11,6 +11,7 @@ import (
"github.com/gnolang/gno/tm2/pkg/commands"

// TODO: move these out.
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types"
"github.com/gnolang/gno/tm2/pkg/bft/blockchain"
Expand All @@ -25,7 +26,6 @@ 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/tm2/pkg/std"
)

Expand Down
7 changes: 2 additions & 5 deletions tm2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ 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
_build.iaviewer:; go build -o build/iaviewer ./pkg/iavl/cmd/iaviewer

.PHONY: install
install:
go install ./cmd/...
# go install ./cmd/...

.PHONY: clean
clean:
Expand All @@ -36,7 +34,7 @@ lint:
########################################
# Test suite
.PHONY: test
test: _test.pkg.amino _test.pkg.bft _test.pkg.others _test.flappy _test.cmds
test: _test.pkg.amino _test.pkg.bft _test.pkg.others _test.flappy

_test.flappy:
# flappy tests should work "sometimes" (at least once).
Expand All @@ -48,4 +46,3 @@ GOTEST_FLAGS ?= -v -p 1 -timeout=30m
_test.pkg.others:; go test $(GOTEST_FLAGS) `go list ./pkg/... | grep -v pkg/amino/ | grep -v pkg/bft/`
_test.pkg.amino:; go test $(GOTEST_FLAGS) ./pkg/amino/...
_test.pkg.bft:; go test $(GOTEST_FLAGS) ./pkg/bft/...
_test.cmds:; go test $(GOTEST_FLAGS) ./cmd/...
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"
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"
"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

0 comments on commit 64f0fd0

Please sign in to comment.