feat(gnovm/lint): enforce last elem of pkg path to match pkg name#5048
Conversation
🛠 PR Checks Summary🔴 Changes related to gnoweb must be reviewed by its codeowners Manual Checks (for Reviewers):
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:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Note: If this is merged we should create an issue on the LSP of Gno about this new feature. |
jefft0
left a comment
There was a problem hiding this comment.
This PR fixes a "Next after mainnet beta" milestone issue. The docs are updated. The breaking change is documented. Includes tests and changes to existing package names to comply. CI checks pass. Ready for core devs to review and decide if and when the breaking changes is wanted.
d74e921 to
a96ae91
Compare
|
with latest changes, we could say that v0 are not audited / safe version and display warning for end users when using v0 realms or using a realm that depends on v0 realms objects or import |
…t-elem-import-path
…t-elem-import-path
…t-elem-import-path
…t-elem-import-path


Description
Closes #1571
Enforces that package names must match the last element of their import path, following Go conventions.
BREAKING CHANGE: Packages with names that don't match their path's last element will be rejected on deployment.
Existing on-chain packages are unaffected, but new deployments must comply. For example, deploying a
package fooatpath
gno.land/r/demo/barwill now fail.Changes
Core validation (
gnovm/pkg/gnolang/mempackage.go):LastPathElement()- extracts the last meaningful path element, skipping version suffixesValidatePkgNameMatchesPath()- ensures package name matches path elementv1,v2,v3, ...) are recognized and skipped when matchingEnforcement:
ValidateMemPackageAny()enforces the check forMPUserAllpackages (on-chain deployment paths: keeperAddPackageand genesis loading)gno lintwarns about mismatches before deploymentValidatePkgNameMatchesPathin the filetest runnerMustPackageNameFromFileBody) instead of from the pathExample package renames:
gnoblog→bloggnopages→pagesfoo20→grc20factoryeval→math_evaltodolistrealm→todolistemitevents→eventsimage_embed→img_embedtests→vm(r/tests/vm)mapdelete→map_deletenir1218_evaluation_proposal→ moved to subfolder/evaluationExamples
gno.land/r/demo/countercountergno.land/r/demo/counterfoogno.land/r/demo/foo/v2foogno.land/r/demo/foo/v1fooContributors' checklist
BREAKING CHANGE: xxxmessage was included in the description