-
Notifications
You must be signed in to change notification settings - Fork 382
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
rfc: the future of gno.mod
#2904
Comments
I asked @n0izn0iz to consider working on the I really think unifying it can be good for both our internal tools and for all external tools, aside from development in general. After that, we can work on better support gno.mod for the most critical workflows we face today and that we currently have to "bodge" with scripts to get working properly. Let me know what you think. |
Thank you very much; addressing this clarifying issue was on my to-do list. 🙏 Overall, it looks good. For the replace directive, I recommend using only local paths. I anticipate that this directive will be used for temporary local work, which I recommend that we do not support downloading packages prefixed with I think we should primarily allow Everything else sounds great to me. Thank you again. |
@moul if the suggested behaviour is to use different domains on-chain for different testnets, I think we should provide some tool to replace all imports from an import path to another. Or else, how do you think we should handle developing outside of the repo, and wanting to target both portal loop and test4, for example? |
When we look to the future with IBC-powered transfers of libraries, imports will remain unchanged from portal loop and test4. If you want "gno.land/p/avl," it can be made available everywhere with this import, not just on portal loop. Ultimately, the only change will be the current addpkg path, as you may want to upload the same contract on two different chains; today this information is only available in ... The tools you're suggesting will exist. I believe it’s wise not to rush them from the core team's perspective; perhaps we should just propose some specifications. My main point is to emphasize that "an import path IS a contract," and this should apply universally around the world. We may encounter some limits, but for now, I support making this a universal rule as much as possible. I also want to avoid any scripts that could produce the same "source code" leading to "different contracts." However, that will happen. I just want to discourage it a bit. Testnets are definitely a special case (local gnodev too) to consider, which is why I'm thinking about implementing strong exceptions for them. However, I want to avoid situations where you can have "something that works without knowing why." I would prefer to have more "things that fail without knowing why" than the opposite. |
Checkout this related PR: #2911 |
The rfc looks great, just a couple of requests for clarification:
Can you elaborate on this? I'm not sure what you meant here.
With that you mean adding the comment |
💯 its very annoying to have to do it every time for The only consideration point I have is: how will So, if we do introduce other features, such as |
IIRC, the current implementation of But, on the portal loop, packages are indeed "mutable", because p/demo/avl can change if we change its source here on github. So we need to support "forcing" an update to all dependencies.
No, just one. We can reject having multiple of them. This extends the existing feature of Go.
Most users will still use I don't know what behaviour gnodev currently has when a package doesn't have a gnodev. Imo, if gnodev has a path which has no gno.mod or And yeah, the |
For all packages it loads, the imports must match that package's requires. I guess I was mainly worried about making gno.mod optional; in that case, no gno.mod => |
I have a dilemma in my implementation of import #2932:
Following current usage would make some things weird, for example, running I think we should follow go logic and then either put a single wdyt? hope this is clear ^^ |
Mhh. What do you think should happen if I want to enable a workflow like a repo having:
Shouldn't I be able to do |
in this case I think we should support workspaces via |
gno.work seems even more work to try to maintain. I tend towards Of course, this is with the exception of |
if we do that, we must assume the Using your previous example: If we If in the Also if you have some gno modules in your tree that should not be part of the current project, like some gno module embedded in a node module, This differs heavily from golang behavior and will probably confuse people |
It's not based on cwd. It just that when we do |
can you write the content of both |
I'd like for there to be just two gnochess files:
If I run, from the root of the project,
After the |
From Manfred's comment on the call:
As a general flow for the package loader. When you specify paths on the CLI, we should parse and understand them as per the above comment ^ |
Introducing the concept of "ChainDomain," a local primary domain for packages. The next step, which will be another PR, is to ensure that we can launch a gnoland/gnodev instance while importing a local folder or using a genesis to preload packages from other domains. This will allow users to add packages only to the primary domain while accessing packages from multiple domains. The result will be a preview of the upcoming IBC era, where a single chain can add packages only to its domain but can fetch missing dependencies from other registered zones. - [x] gnovm unaware of gno.land, just accepting valid domains - [x] vmkeeper initialized with a domain - [x] Stdlib to know the current primary domain + new std.ChainDomain - [x] new unit tests around custom domains Depends on #2910 Depends on #3003 Blocks a new PR that will add multidomain support. Related with #2904 (comment) --------- Signed-off-by: moul <[email protected]> Co-authored-by: n0izn0iz <[email protected]> Co-authored-by: Mikael VALLENET <[email protected]> Co-authored-by: Morgan <[email protected]>
A step towards the importer package (#2932) and future of `gno.mod` (#2904) - BREAKING CHANGE: remove `require` statement support from `gno.mod` - BREAKING CHANGE: remove `-v` (verbose) and `--remote` flags in `gno mod download` - Don't require version specification in `gno.mod`'s `replace` statements - Use `.gno` files `import` statements to find dependencies - Extract and refacto imports gathering utils in `gnovm/pkg/packages` - Add `gnovm/cmd/gno/internal/pkgdownload.PackageFetcher` interface - Implement `PackageFetcher` using `vm/qfile` queries in `gnovm/cmd/gno/internal/pkgdownload/rpcpackagefetcher` - Rewrite single package download routine in `gnovm/cmd/gno/internal/pkgdownload` - Move and refacto dependencies download routine in `gnovm/cmd/gno/download_deps.go` - Add a `--remote-overrides` flag for `gno mod download` that takes `chain-domain=rpc-url` comma-separated pairs to override endpoints used to fetch packages - Add and use a testing implementation of `PackageFetcher` called `examplesPackageFetcher` that serves package from the `examples` directory for testing purposes (download tests before this PR use the portal loop public endpoint) - Make `ReadMemPackage` and it's dependencies error-out instead of panicking - Create panicking `MemPackage` utils that wrap the erroring ones and use them at existing callsites I decided to do this first to avoid having multiple ways to resolve dependencies lying around in the codebase and causing confusion in subsequent steps <details><summary>Contributors' checklist...</summary> - [x] 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 - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests </details> --------- Signed-off-by: Norman Meier <[email protected]> Co-authored-by: Morgan Bazalgette <[email protected]>
Introducing the concept of "ChainDomain," a local primary domain for packages. The next step, which will be another PR, is to ensure that we can launch a gnoland/gnodev instance while importing a local folder or using a genesis to preload packages from other domains. This will allow users to add packages only to the primary domain while accessing packages from multiple domains. The result will be a preview of the upcoming IBC era, where a single chain can add packages only to its domain but can fetch missing dependencies from other registered zones. - [x] gnovm unaware of gno.land, just accepting valid domains - [x] vmkeeper initialized with a domain - [x] Stdlib to know the current primary domain + new std.ChainDomain - [x] new unit tests around custom domains Depends on gnolang#2910 Depends on gnolang#3003 Blocks a new PR that will add multidomain support. Related with gnolang#2904 (comment) --------- Signed-off-by: moul <[email protected]> Co-authored-by: n0izn0iz <[email protected]> Co-authored-by: Mikael VALLENET <[email protected]> Co-authored-by: Morgan <[email protected]>
…ng#3123) A step towards the importer package (gnolang#2932) and future of `gno.mod` (gnolang#2904) - BREAKING CHANGE: remove `require` statement support from `gno.mod` - BREAKING CHANGE: remove `-v` (verbose) and `--remote` flags in `gno mod download` - Don't require version specification in `gno.mod`'s `replace` statements - Use `.gno` files `import` statements to find dependencies - Extract and refacto imports gathering utils in `gnovm/pkg/packages` - Add `gnovm/cmd/gno/internal/pkgdownload.PackageFetcher` interface - Implement `PackageFetcher` using `vm/qfile` queries in `gnovm/cmd/gno/internal/pkgdownload/rpcpackagefetcher` - Rewrite single package download routine in `gnovm/cmd/gno/internal/pkgdownload` - Move and refacto dependencies download routine in `gnovm/cmd/gno/download_deps.go` - Add a `--remote-overrides` flag for `gno mod download` that takes `chain-domain=rpc-url` comma-separated pairs to override endpoints used to fetch packages - Add and use a testing implementation of `PackageFetcher` called `examplesPackageFetcher` that serves package from the `examples` directory for testing purposes (download tests before this PR use the portal loop public endpoint) - Make `ReadMemPackage` and it's dependencies error-out instead of panicking - Create panicking `MemPackage` utils that wrap the erroring ones and use them at existing callsites I decided to do this first to avoid having multiple ways to resolve dependencies lying around in the codebase and causing confusion in subsequent steps <details><summary>Contributors' checklist...</summary> - [x] 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 - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests </details> --------- Signed-off-by: Norman Meier <[email protected]> Co-authored-by: Morgan Bazalgette <[email protected]>
Introducing the concept of "ChainDomain," a local primary domain for packages. The next step, which will be another PR, is to ensure that we can launch a gnoland/gnodev instance while importing a local folder or using a genesis to preload packages from other domains. This will allow users to add packages only to the primary domain while accessing packages from multiple domains. The result will be a preview of the upcoming IBC era, where a single chain can add packages only to its domain but can fetch missing dependencies from other registered zones. - [x] gnovm unaware of gno.land, just accepting valid domains - [x] vmkeeper initialized with a domain - [x] Stdlib to know the current primary domain + new std.ChainDomain - [x] new unit tests around custom domains Depends on gnolang#2910 Depends on gnolang#3003 Blocks a new PR that will add multidomain support. Related with gnolang#2904 (comment) --------- Signed-off-by: moul <[email protected]> Co-authored-by: n0izn0iz <[email protected]> Co-authored-by: Mikael VALLENET <[email protected]> Co-authored-by: Morgan <[email protected]>
…ng#3123) A step towards the importer package (gnolang#2932) and future of `gno.mod` (gnolang#2904) - BREAKING CHANGE: remove `require` statement support from `gno.mod` - BREAKING CHANGE: remove `-v` (verbose) and `--remote` flags in `gno mod download` - Don't require version specification in `gno.mod`'s `replace` statements - Use `.gno` files `import` statements to find dependencies - Extract and refacto imports gathering utils in `gnovm/pkg/packages` - Add `gnovm/cmd/gno/internal/pkgdownload.PackageFetcher` interface - Implement `PackageFetcher` using `vm/qfile` queries in `gnovm/cmd/gno/internal/pkgdownload/rpcpackagefetcher` - Rewrite single package download routine in `gnovm/cmd/gno/internal/pkgdownload` - Move and refacto dependencies download routine in `gnovm/cmd/gno/download_deps.go` - Add a `--remote-overrides` flag for `gno mod download` that takes `chain-domain=rpc-url` comma-separated pairs to override endpoints used to fetch packages - Add and use a testing implementation of `PackageFetcher` called `examplesPackageFetcher` that serves package from the `examples` directory for testing purposes (download tests before this PR use the portal loop public endpoint) - Make `ReadMemPackage` and it's dependencies error-out instead of panicking - Create panicking `MemPackage` utils that wrap the erroring ones and use them at existing callsites I decided to do this first to avoid having multiple ways to resolve dependencies lying around in the codebase and causing confusion in subsequent steps <details><summary>Contributors' checklist...</summary> - [x] 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 - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests </details> --------- Signed-off-by: Norman Meier <[email protected]> Co-authored-by: Morgan Bazalgette <[email protected]>
Introducing the concept of "ChainDomain," a local primary domain for packages. The next step, which will be another PR, is to ensure that we can launch a gnoland/gnodev instance while importing a local folder or using a genesis to preload packages from other domains. This will allow users to add packages only to the primary domain while accessing packages from multiple domains. The result will be a preview of the upcoming IBC era, where a single chain can add packages only to its domain but can fetch missing dependencies from other registered zones. - [x] gnovm unaware of gno.land, just accepting valid domains - [x] vmkeeper initialized with a domain - [x] Stdlib to know the current primary domain + new std.ChainDomain - [x] new unit tests around custom domains Depends on gnolang#2910 Depends on gnolang#3003 Blocks a new PR that will add multidomain support. Related with gnolang#2904 (comment) --------- Signed-off-by: moul <[email protected]> Co-authored-by: n0izn0iz <[email protected]> Co-authored-by: Mikael VALLENET <[email protected]> Co-authored-by: Morgan <[email protected]>
…ng#3123) A step towards the importer package (gnolang#2932) and future of `gno.mod` (gnolang#2904) - BREAKING CHANGE: remove `require` statement support from `gno.mod` - BREAKING CHANGE: remove `-v` (verbose) and `--remote` flags in `gno mod download` - Don't require version specification in `gno.mod`'s `replace` statements - Use `.gno` files `import` statements to find dependencies - Extract and refacto imports gathering utils in `gnovm/pkg/packages` - Add `gnovm/cmd/gno/internal/pkgdownload.PackageFetcher` interface - Implement `PackageFetcher` using `vm/qfile` queries in `gnovm/cmd/gno/internal/pkgdownload/rpcpackagefetcher` - Rewrite single package download routine in `gnovm/cmd/gno/internal/pkgdownload` - Move and refacto dependencies download routine in `gnovm/cmd/gno/download_deps.go` - Add a `--remote-overrides` flag for `gno mod download` that takes `chain-domain=rpc-url` comma-separated pairs to override endpoints used to fetch packages - Add and use a testing implementation of `PackageFetcher` called `examplesPackageFetcher` that serves package from the `examples` directory for testing purposes (download tests before this PR use the portal loop public endpoint) - Make `ReadMemPackage` and it's dependencies error-out instead of panicking - Create panicking `MemPackage` utils that wrap the erroring ones and use them at existing callsites I decided to do this first to avoid having multiple ways to resolve dependencies lying around in the codebase and causing confusion in subsequent steps <details><summary>Contributors' checklist...</summary> - [x] 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 - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests </details> --------- Signed-off-by: Norman Meier <[email protected]> Co-authored-by: Morgan Bazalgette <[email protected]>
There's been some misalignments in the vision for what we want to do with
gno.mod
. I think it makes sense here to attempt to align on what vision we see on it, especially for the short, practical term; ie. ahead of the mainnet launch. I think there's some outdated and redundant functionality that can be removed; some critical that should be added. But in general I think we need to agree on where want to go with it in a pre-versioning world (note: I've closed #694 in light of many discussions within the core team; we decided to delay any considerations on built-in upgrade mechanisms for realm to after a point where we've acquired some experience with upgrading the chain and its contracts.)What should be cut
import
statements - the "source of truth) and what exists in gno.mod, often just generated withgno mod tidy
. We don't have versioning, and won't for another while, so the version field sayingv0.0.0-latest
is absolutely redundant.gno mod why
is not useful - or at least not as part of thegno mod
suite.gno mod tidy
is no longer necessary.What should be added
In essence, gno.mod can be a good tool right now to be developed in conjunction with a better "importer" module: #2201.
The purpose of the
importer
PR is to create a centralized place to resolve import paths to specific files. At the moment, how this is done is scattered all throughout the codebase, and there are different implementations for how this works, for instance ingno doc
andgno run
. Once we unify this behaviour, we can make the importer understand gno.mod and become useful to us, enabling some crucial workflows:The first workflow is already partially supported. Outside of the monorepo, we can use
gno.mod
to automatically set the import paths forgnodev
. Plus, I think it may be partially supported forgno test
- though this matters little. The problem is that any imports downloaded withgno mod download
are still not resolved (except bygno doc
, lol).Hence why, after we unify this, here are other things I see as features we should have for
gno mod
, especially in conjunction with correct resolution into the packages downloaded in~/.config/gno/pkg/mod
:-u
to update packages - this makes sure we can support the portal loop.gno mod download test4.gno.land/p/demo/avl
will download the test4-specific version of p/demo/avl.importer
should understandtest4.gno.land/
as an import path - considerations to be done here on how this should be handled on-chain.replace
#2601replace gno.land/p/demo/boards => ./boards
replace gno.land/p/demo/avl => test4.gno.land/p/demo/avl
.replace gno.land/... => test4.gno.land/...
.gnomod
optional everywhere #1039// import "gno.land/r/demo/myrealm"
as a way to short-hand set an import for the current directory; an implicit "gno.mod".morgan
has a gno.mod withmodule gno.land/r/morgan
, then sub-directorymorgan/home
should have import pathgno.land/r/morgan/home
. (Circles back to Gnopher hole: Module VS Pkg VS Path VS Dir VS SubPkg VS SubModule VS SubDir VS SubPath ... #1024 )This is a request-for-comment; I want to gather whether we agree that this is a good way forward for now, so we can point to this plan.
The text was updated successfully, but these errors were encountered: