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

refactor: reorganize project, isolate components (tm2, gnovm, gno.land, ...) #585

Merged
merged 10 commits into from
Apr 3, 2023

Conversation

moul
Copy link
Member

@moul moul commented Mar 10, 2023

BREAKING CHANGES:

  • The build instructions have been altered, so the tutorials need to be revised accordingly.
  • The import paths have been changed, any external repositories that depend on gno will not be able to compile if they update their dependencies.

  • Create a top-level gnovm, gno.land, tendermint2 folders. No more top-level pkgs, cmd folders.
  • Decide how to handle the case of pkgs/std (see comments below).
  • Update CI, split it by main component.
  • Create/update */README.md and update top-level one too.
  • Create/update */Makefile (when it makes sense) and update top-level one too.
  • Add a disclaimer on tm2 upstream README.md, linking to this PR. (chore: add disclaimer pointing to gno monorepo tendermint/tendermint2#12)
  • Cleanup unused files (old protos).

Next steps (new PRs):

  • Migrate tm2/pkg/sdk/vm and pkg/crypto/keys/client parts depending on gnovm either in gnovm or gno.land.
  • Setup go mod workspaces.
  • Create standalone tm2 demo chain + client (done in chore: post-split cleanups tendermint/tendermint2#1).
  • Setup vanity URLs for tm2 and "the rest".
  • Improve CI, ensuring tm2 won't depend on nothing "gno*", i.e., grep gnovm from dedicated go.mod.

Addresses #577

@moul moul self-assigned this Mar 10, 2023
@moul moul changed the title chore: move tendermint2 pkgs into tendermint2/pkgs chore: move tendermint2 pkgs into tendermint2/ Mar 10, 2023
@moul
Copy link
Member Author

moul commented Mar 12, 2023

Current thinking:

GnoVM can be run independently of Tendermint2, such as with Tendermint1 as a module or with a custom implementation outside of the Cosmos ecosystem. Therefore, GnoVM should not rely on any imports from T2.

We have a shared package named std which is imported by both T2 and GnoVM. An alternative to splitting each package into its own std package is to create a separate folder such as common or types. However, I do not prefer this option as it can lead to confusion. My current preferred option is to consider that T2 depends on GnoVM, which does not require enabling full smart-contracts features on a T2 chain, but rather is focused on managing consensus and networking. Tokens and other objects are built into GnoVM.

My goal is to compete with Cosmos-SDK by providing a way to customize a blockchain with contracts. This does not preclude the possibility of adding Cosmos-SDK as well.

I suggest that we maintain std within GnoVM and import it from T2.

If it is essential that T2 does not rely on GnoVM, I can create an interface for the std package while keeping the implementation in GnoVM and the connection in gnoland.

@moul
Copy link
Member Author

moul commented Mar 12, 2023

I would like to suggest the following regarding a global monorepo architecture:

* README.md, Makefile, .github, editor configs, etc
* gnovm/
  * README.md, Makefile, ...
  * tests/
  * pkgs/
    * gnolang/
    * std/
  * stdlibs/
  * cmd/
    * gno/  # new name for `gnodev`
    * gnokey/
* tendermint2/
  * README.md, Makefile, ...
  * pkgs/
  * cmd/
    * t2c/ # generic tendermint2 client
    * t2txsync/ # previous gnotxport
  * sync-with-upstream.sh # or similar
* gno.land/
  * genesis/
  * cmd/
    * gnoweb/
    * gnoland/
* examples/gno.land/{p,r}... # we keep this at root level
* misc/ # for scripts, helpers, and things for advanced usages.

@jaekwon
Copy link
Contributor

jaekwon commented Mar 21, 2023

In pkgs/std, most files are needed for Tendermint2 only, not Gno.

  • pkgs/std/account.go could move into pkgs/sdk/auth/types.go or elsewhere in the sdk.
  • pkgs/std/coins.go could move into pkgs/coins, but I think it's worth keeping it and making accessible to TM2.
  • most of the rest are for Tendermint2.

I think TM2/std should act as a type of "common" type. This goes along with TM2's goal of being a swiss army (#2 in https://github.com/tendermint/tendermint2 for now anyways). When we need to we can create adapters between TM1 and TM2, but TM2/std is an opportunity to make breaking changes and imagine what is a good "common" from a blank slate.

So I would say that GnoVM and gno.land should import from TM2/std.

@jaekwon
Copy link
Contributor

jaekwon commented Mar 21, 2023

Also suggest gnovm -> gno and tendermint2 -> tm2 for succinctness, tm2 to be renamed later.
Are we assuming that the plan is to split tendermint2 out later?

@moul
Copy link
Member Author

moul commented Mar 21, 2023

Are we assuming that the plan is to split tendermint2 out later?

Eventually, but still by keeping a fork in the gnolang organization and synchronizing changes manually when it makes sense. See #577 for further discussions.

@grepsuzette
Copy link
Contributor

I think gnovm is a better directory name than gno though.
Because when cloned, the parent is going to be called gno already.
It will help beginnner to understand what is what. I like tm2 better as well.

@moul
Copy link
Member Author

moul commented Mar 22, 2023

I think gnovm is a better directory name than gno though.

I had the same thought as you while I was implementing it.

The name of gnodev will be changed to gno, as initially proposed in issue #482.

-> github.com/gnolang/gno/gnovm/cmd/gno

@moul moul force-pushed the dev/moul/split-t2 branch 4 times, most recently from 793a122 to a8d28ce Compare March 28, 2023 07:27
@moul-bot moul-bot force-pushed the dev/moul/split-t2 branch 3 times, most recently from 6e12961 to 11825ff Compare March 28, 2023 17:26
@moul
Copy link
Member Author

moul commented Mar 28, 2023

Summary of the last discussion:

  • continue the folder reorganization to improve the separation of concerns, discoverability, simplicity, and focus.
  • github.com/tendermint/tendermint2 will be updated with a disclaimer saying that we focus dev effort on the gno monorepo until it becomes stable (@jaekwon).
  • update t2/README.md with a disclaimer saying we'll extract the work one day.
  • skip the need for a script now; we'll figure out this later if it makes sense.

@moul moul changed the title chore: move tendermint2 pkgs into tendermint2/ refactor: move tendermint2 pkgs into tendermint2/ Mar 29, 2023
@moul moul changed the title refactor: move tendermint2 pkgs into tendermint2/ refactor: reorganize project structure and isolate main components (t2, gnovm, gno.land, ...) Mar 29, 2023
@moul moul changed the title refactor: reorganize project structure and isolate main components (t2, gnovm, gno.land, ...) refactor: reorganize project, isolate components (t2, gnovm, gno.land, ...) Mar 29, 2023
@moul-bot moul-bot force-pushed the dev/moul/split-t2 branch 8 times, most recently from 3d6c3df to adc6b95 Compare March 29, 2023 21:55
@moul moul marked this pull request as ready for review March 29, 2023 22:06
Copy link
Contributor

@harry-hov harry-hov left a comment

Choose a reason for hiding this comment

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

LGTM. 💯

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.

I'm a bit late to the party, but this looks great 💯

I love that it's much more streamlined now and easier to follow, especially for new contributors. I also had to look up the syntax in the nested Makefiles and learned something new 🙂

.github/workflows/tm2.yml Outdated Show resolved Hide resolved
@moul
Copy link
Member Author

moul commented Apr 3, 2023

Thank you all for the review; I'll make a last rebase with master, wait for green CI, and merge.

moul and others added 9 commits April 3, 2023 15:31
…d, ...)

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Co-authored-by: Morgan <git@howl.moe>
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Co-authored-by: Thomas Bruyelle <thomas.bruyelle@gmail.com>
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Co-authored-by: Morgan <git@howl.moe>
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
@moul moul merged commit 98cc986 into gnolang:master Apr 3, 2023
@moul moul deleted the dev/moul/split-t2 branch April 3, 2023 14:09
@moul moul mentioned this pull request Apr 3, 2023
5 tasks
grepsuzette pushed a commit to grepsuzette/gno that referenced this pull request Apr 6, 2023
…d, ...) (gnolang#585)

Co-authored-by: Morgan <git@howl.moe>
Co-authored-by: Thomas Bruyelle <thomas.bruyelle@gmail.com>
@thehowl thehowl mentioned this pull request Apr 18, 2023
@piux2 piux2 mentioned this pull request May 16, 2023
9 tasks
moul added a commit that referenced this pull request Aug 31, 2023
<!-- 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 <94029+moul@users.noreply.github.com>
@moul moul added this to the 🚀 main.gno.land (required) milestone Sep 18, 2023
@harry-hov harry-hov mentioned this pull request Jan 10, 2024
7 tasks
harry-hov added a commit that referenced this pull request Jan 11, 2024
Months after the renaming `gnodev` to `gno` (in
#585), I still found some references
of gnodev.
Fixed it.
gfanton pushed a commit to moul/gno that referenced this pull request Jan 18, 2024
Months after the renaming `gnodev` to `gno` (in
gnolang#585), I still found some references
of gnodev.
Fixed it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Functionality that contains breaking changes
Projects
Status: ✅ Done
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants