diff --git a/gno.land/pkg/sdk/vm/keeper.go b/gno.land/pkg/sdk/vm/keeper.go index bf16cd44243..1b93cf61907 100644 --- a/gno.land/pkg/sdk/vm/keeper.go +++ b/gno.land/pkg/sdk/vm/keeper.go @@ -234,8 +234,8 @@ var reNamespace = regexp.MustCompile(`^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/(?:r|p)/([\. // checkNamespacePermission check if the user as given has correct permssion to on the given pkg path func (vm *VMKeeper) checkNamespacePermission(ctx sdk.Context, creator crypto.Address, pkgPath string) error { - sysUsersPkg := vm.getSysUsersPkgParam(ctx) - if sysUsersPkg == "" { + sysNamesPkg := vm.getSysNamesPkgParam(ctx) + if sysNamesPkg == "" { return nil } chainDomain := vm.getChainDomainParam(ctx) @@ -257,7 +257,7 @@ func (vm *VMKeeper) checkNamespacePermission(ctx sdk.Context, creator crypto.Add username := match[1] // if `sysUsersPkg` does not exist -> skip validation. - usersPkg := store.GetPackage(sysUsersPkg, false) + usersPkg := store.GetPackage(sysNamesPkg, false) if usersPkg == nil { return nil } @@ -289,13 +289,13 @@ func (vm *VMKeeper) checkNamespacePermission(ctx sdk.Context, creator crypto.Add }) defer m.Release() - // call $sysUsersPkg.IsAuthorizedAddressForName("") - // We only need to check by name here, as address have already been check + // call sysNamesPkg.IsAuthorizedAddressForName("") + // We only need to check by name here, as addresses have already been checked mpv := gno.NewPackageNode("main", "main", nil).NewPackage() m.SetActivePackage(mpv) - m.RunDeclaration(gno.ImportD("users", sysUsersPkg)) + m.RunDeclaration(gno.ImportD("names", sysNamesPkg)) x := gno.Call( - gno.Sel(gno.Nx("users"), "IsAuthorizedAddressForName"), + gno.Sel(gno.Nx("names"), "IsAuthorizedAddressForName"), gno.Str(creator.String()), gno.Str(username), ) diff --git a/gno.land/pkg/sdk/vm/params.go b/gno.land/pkg/sdk/vm/params.go index 248fb8a81fb..c673f2b5b5f 100644 --- a/gno.land/pkg/sdk/vm/params.go +++ b/gno.land/pkg/sdk/vm/params.go @@ -3,7 +3,7 @@ package vm import "github.com/gnolang/gno/tm2/pkg/sdk" const ( - sysUsersPkgParamPath = "gno.land/r/sys/params.sys.users_pkgpath.string" + sysNamesPkgParamPath = "gno.land/r/sys/params.sys.names_pkgpath.string" chainDomainParamPath = "gno.land/r/sys/params.chain_domain.string" ) @@ -13,8 +13,8 @@ func (vm *VMKeeper) getChainDomainParam(ctx sdk.Context) string { return chainDomain } -func (vm *VMKeeper) getSysUsersPkgParam(ctx sdk.Context) string { - var sysUsersPkg string - vm.prmk.GetString(ctx, sysUsersPkgParamPath, &sysUsersPkg) - return sysUsersPkg +func (vm *VMKeeper) getSysNamesPkgParam(ctx sdk.Context) string { + var sysNamesPkg string + vm.prmk.GetString(ctx, sysNamesPkgParamPath, &sysNamesPkg) + return sysNamesPkg }