gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
842 stars 343 forks source link

rfc: move `examples` to `gno.land/genesis` #1589

Open thehowl opened 5 months ago

thehowl commented 5 months ago

This came up in a conversation w/ @leohhhn. Essentially, the "examples" directory, while useful, is not entirely true to what its purpose is. We know it does not just contain examples of gno code, but actually it contains all the packages and realms that are initialized with the gno.land genesis node when starting it up.

The way I propose to change this is:

This also came up yesterday in conversation with @jaekwon. (IIRC: "If we are working towards eventually splitting gno.land, tm2 and gnovm into their own repositories, does it not make sense for the examples directory to be contained in gno.land or gnovm?)

waymobetta commented 5 months ago

I agree that this examples directory needs to be renamed, but my main concern is not what this repo is named or where it should be moved to but rather understanding what the criteria is for a package/realm to make it into this directory in the first place; @moul describes these as userland.

If these packages/realms are deployed at genesis, and are therefore foundational to the chain, then their inclusion should be carefully considered (perhaps even voted on) with each resource being deemed absolutely necessary and serve to epitomize proper package/realm standards (clear naming convention, well commented, organized, not a WIP) in accordance to Effective Gno. Personally, I feel that getting a package/realm into this directory should be a thoughtful process (much like an EIP) as it is effectively an endorsement by the core team with the opportunity of imprinting on the chain at genesis.

I also like the idea of an examples repo for devrel to own but believe this should live outside of the monorepo.

thehowl commented 5 months ago

I agree that this examples directory needs to be renamed, but my main concern is not what this repo is named or where it should be moved to but rather understanding what the criteria is for a package/realm to make it into this directory in the first place; @moul describes these as userland.

I don't see creating a "perfect genesis" directory as crucial in this moment.

As of right now, we don't even have any up-to-date testnet. Putting your code in examples (or genesis) is really the best place to do it, otherwise we just have a bunch of useful gno code scattered in random repositories on GitHub. In this moment, having a lot of packages and realms in examples also helps us test that we haven't introduced any regressions in the CI, when modifying gnovm code.

Vetting and auditing all existing contracts before launching mainnet is already part of the roadmap being drafted. And I'm pretty sure it will be conservative, too: only the packages in p/ which have been tried and vetted over the course of several months of writing dApps and Gno software will make it in; everything else will have to be re-uploaded later by the authors.

I've thought of a middleground solution (creating an "official" set of genesis packages, and a "supplemental" which is expected to not make it into genesis but is where we can put gno code right now). I don't like it, though, because we ultimately don't know which packages and realm are going to be useful when we create them and obsessing over what should go where leads to more burocratization and slowness in managing code that we don't need right now.

waymobetta commented 5 months ago

In this moment, having a lot of packages and realms in examples also helps us test that we haven't introduced any regressions in the CI, when modifying gnovm code.

Yep, understood. Then it makes sense to keep some packages/realms housed within the monorepo for testing. I like the idea of having code re-uploaded by authors later as well once we are in a more stable place and the proposed middleground solution makes sense.

moul commented 5 months ago

We should keep certain contracts as the default, similar to a stdlib of contracts. The current folder contains both contracts that should be built-in and examples that will need to be moved later. Currently, it is logical to have everything in a single folder, and we can consider dividing it into src and samples later.

After splitting, we can transfer the non-essential contracts to ./gno.land/genesis. The essential contracts could eventually be moved to ./gnovm/basecontracts.

Today, we should keep everything in the monorepo and examples folder. Because, the future basecontracts are not finished yet, and none of them (except maybe p/avl) can be considered safe enough to become a standard. We should postpone the split until we determine the proper placement of everything. Perhaps we can use an EIP approach, as suggested by @waymobetta. However, we are currently unprepared for this.