8000 feat(modfile): switch to gnomod.toml v2 by moul · Pull Request #4331 · gnolang/gno · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(modfile): switch to gnomod.toml v2 #4331

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

Merged
merged 81 commits into from
Jun 15, 2025
Merged

Conversation

moul
Copy link
Member
@moul moul commented May 28, 2025

Meta: #4365

Once merged, it will unlock several features:

  • It will allow for easy addition of new fields with impact, such as:
    • private=true: This makes the object not importable and prevents local objects from being persisted remotely, for example, in a registry, specifically for a /home realm, ensuring it can be upgraded by fully replacing the source code.
    • draft=true: This reuses the previous draft keyword for a different purpose, allowing us to mark some packages as "published on genesis but not importable by addpkg." This way, we can publish contracts now, have them audited, and then republish them or use editpkg to modify some gnomod.toml fields, such as changing from private=true to private=false.
  • Gnoweb will parse this file to enhance the UI with links to the uploader and more.

  • support gnomod.toml
  • migration from gno.mod to gnomod.toml
  • lazy generation of gnomod.toml in most gno xxx commands
  • update of gnomod.toml with gno mod tidy
  • patch gnomod.toml when vm.AddPackage
  • fix unit tests

Alternative to #4263

8000

moul added 2 commits May 28, 2025 15:26
Signed-off-by: moul <94029+moul@users.noreply.github.com>
@Gno2D2
Copy link
Collaborator
Gno2D2 commented May 28, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: moul/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@moul moul changed the title dev/moul/gno toml 2 WIP feat(modfile): switch to gnomod.toml v2 May 28, 2025
@moul moul force-pushed the dev/moul/gno-toml-2 branch from 387723b to c8eac4c Compare May 28, 2025 17:11
@moul moul requested review from jeronimoalbi, aeddi and n0izn0iz June 12, 2025 20:19
moul and others added 7 commits June 12, 2025 22:41
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Copy link
Member
@gfanton gfanton left a comment

Choose a reason for hiding this comment

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

nice

Copy link
Member
@jeronimoalbi jeronimoalbi left a comment

Choose a reason for hiding this comment

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

LGTM

@leohhhn
Copy link
Contributor
leohhhn commented Jun 13, 2025

A couple of questions:

  1. Should we make the toml required in each package? Ie right now i get a toml not found error in a folder with only gno files when running gnodev in it
  2. Are we concerned that gno mod init initializes the file without a gno version? Maybe put the default 0.9 for now? To avoid the expected gnomod.toml gno version 0.9 but got 0.0 error, making the dev experience a bit smoother.
  3. When using gnodev, doing gno mod init invalidpkgpath creates a .toml, and everything seems fine until you try opening up gnoweb and the input is invalidpkgpath which leads to nowhere. I think we should check for the gno.land/{p,r}/ prefix and disallow the rest upon package creation. Probably would make the user experience a bit better, as they would get a clear error and an instruction on how to fix it.
  4. I can deploy to r/leon/test with gnokey, with an invalid module var in the toml, ie invalidpkg. Should we enforce module name = deploy pkgpath?
  5. I think we should make gnoweb render the toml file in the package source page - can be done later.

Need to play around a bit more, but definitely looks like a change for the better over the old gno mod :)

Docs need to be updated as well, I'm on it soon.

moul and others added 4 commits June 13, 2025 21:53
Co-authored-by: Jerónimo Albi <jeronimo.albi@gmail.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
@moul
Copy link
Member Author
moul commented Jun 13, 2025

Should we make the toml required in each package? Ie right now i get a toml not found error in a folder with only gno files when running gnodev in it

It's already the case, since the gno0.9 PR.

Are we concerned that gno mod init initializes the file without a gno version? Maybe put the default 0.9 for now? To avoid the expected gnomod.toml gno version 0.9 but got 0.0 error, making the dev experience a bit smoother.

52a5676

When using gnodev, doing gno mod init invalidpkgpath creates a .toml, and everything seems fine until you try opening up gnoweb and the input is invalidpkgpath which leads to nowhere. I think we should check for the gno.land/{p,r}/ prefix and disallow the rest upon package creation. Probably would make the user experience a bit better, as they would get a clear error and an instruction on how to fix it.

b502de9

I can deploy to r/leon/test with gnokey, with an invalid module var in the toml, ie invalidpkg. Should we enforce module name = deploy pkgpath?

Yes, the gnomod.toml file should be taken into account. While simplicity is generally important, the deployed pkgpath is a sensitive variable that we want to clarify in the request (as the amount of tokens you send, or the key you're using). Therefore, we can either establish a validation/review period to inform the signer of the exact package name or... keep the parameter and trigger an error if cli.pkgpath != gnomod.pkgpath. Alternatively, we could accept a -pkgpath=gnomod (default?) that assumes we trust the contents of the file.
Let's address this in an upcoming PR.

For now, I added an extra check to prevent uploading if pkgpath does not equal gnomod.Module: 9cb82fb.

Edit: As a shortcut, I ensured that the gnomod.toml file was overridden with the provided pkgpath during the upload: a30a1d6.

I think we should make gnoweb render the toml file in the package source page - can be done later.

-> #4365

Need to play around a bit more, but definitely looks like a change for the better over the old gno mod :)

👍

Docs need to be updated as well, I'm on it soon.

Thank you 🙏

moul added 3 commits June 13, 2025 22:34
Signed-off-by: moul <94029+moul@users.noreply.github.com>
…ed pkgpath

Signed-off-by: moul <94029+moul@users.noreply.github.com>
@moul moul merged commit bf89d1c into gnolang:master Jun 15, 2025
97 checks passed
@moul moul deleted the dev/moul/gno-toml-2 branch June 15, 2025 17:07
@github-project-automation github-project-automation bot moved this from 📥 Inbox to ✅ Done in 😎 Manfred's Board Jun 15, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in 💪 Bounties & Worx Jun 15, 2025
@github-project-automation github-project-automation bot moved this from In Review to Done in 🧙‍♂️gno.land core team A3E2 Jun 15, 2025
stefann-01 pushed a commit to stefann-01/gno that referenced this pull request Jul 14, 2025
Meta: gnolang#4365 

Once merged, it will unlock several features:

-  It will allow for easy addition of new fields with impact, such as:
- `private=true`: This makes the object not importable and prevents
local objects from being persisted remotely, for example, in a registry,
specifically for a /home realm, ensuring it can be upgraded by fully
replacing the source code.
- `draft=true`: This reuses the previous draft keyword for a different
purpose, allowing us to mark some packages as "published on genesis but
not importable by `addpkg`." This way, we can publish contracts now,
have them audited, and then republish them or use `editpkg` to modify
some `gnomod.toml` fields, such as changing from `private=true` to
`private=false`.
- Gnoweb will parse this file to enhance the UI with links to the
uploader and more.

---

- [x] support `gnomod.toml`
- [x] migration from `gno.mod` to `gnomod.toml`
- [x] lazy generation of `gnomod.toml` in most `gno xxx` commands
- [x] update of `gnomod.toml` with `gno mod tidy`
- [x] patch `gnomod.toml` when `vm.AddPackage`
- [x] fix unit tests

Alternative to gnolang#4263

---------

Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Co-authored-by: Antonio Navarro Perez <antnavper@gmail.com>
Co-authored-by: gfanton <8671905+gfanton@users.noreply.github.com>
Co-authored-by: aeddi <antoine.e.b@gmail.com>
Co-authored-by: Jerónimo Albi <jeronimo.albi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: Done
Status: ✅ Done
Archived in project
Development

Successfully merging this pull request may close these issues.

9 participants
0