Skip to content
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

[GnoVM]: Do not allow realms to store references to objects owned by other realms #2332

Closed
deelawn opened this issue Jun 11, 2024 · 2 comments
Assignees

Comments

@deelawn
Copy link
Contributor

deelawn commented Jun 11, 2024

The issue title describes it pretty well. The following test should not pass because bbb is trying to save a reference to an object owned by aaa:

loadpkg gno.land/r/xx/aaa $WORK/aaa
loadpkg gno.land/r/xx/bbb $WORK/bbb

## start a new node
gnoland start

gnokey maketx call -pkgpath gno.land/r/xx/bbb -func SaveARef -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1
stdout 'OK!'


-- aaa/a.gno --
package aaa

var A int

-- bbb/b.gno --
package bbb

import "gno.land/r/xx/aaa"

var B *int

func SaveARef() {
    B = &aaa.A
}

@omarsy
Copy link
Member

omarsy commented Nov 10, 2024

Don't know, Why should we forbid this case? If we do, we should forbid these cases ?

loadpkg gno.land/r/xx/aaa $WORK/aaa
loadpkg gno.land/r/xx/bbb $WORK/bbb

## Start a new node
gnoland start

gnokey maketx call -pkgpath gno.land/r/xx/bbb -func SaveARef -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1


-- aaa/a.gno --
package aaa

var A int = 5

func GetRef() *int {
  return &A
}


-- bbb/b.gno --
package bbb

import "gno.land/r/xx/aaa"

var B *int

func SaveARef() {
    B = aaa.GetRef()
}
loadpkg gno.land/r/xx/aaa $WORK/aaa
loadpkg gno.land/r/xx/bbb $WORK/bbb

## Start a new node
gnoland start

gnokey maketx call -pkgpath gno.land/r/xx/bbb -func SaveARef -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1


-- aaa/a.gno --
package aaa

var A *int


-- bbb/b.gno --
package bbb

import "gno.land/r/xx/aaa"

var B *int

func SaveARef() {
    B = aaa.A
}

@Kouteki Kouteki moved this to Rejected in 🍜 Seoul triage Nov 13, 2024
@Kouteki Kouteki assigned mvertes and unassigned thehowl Nov 29, 2024
@Kouteki Kouteki added the in focus Core team is prioritizing this work label Nov 29, 2024
@Kouteki Kouteki moved this from Todo to In Progress in 🧙‍♂️gno.land core team Dec 2, 2024
@zivkovicmilos
Copy link
Member

From the sync call:

This is a wanted behavior for now.
Reference for realm ownership: #2743

@zivkovicmilos zivkovicmilos closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in 🧙‍♂️gno.land core team Jan 8, 2025
@Kouteki Kouteki removed the in focus Core team is prioritizing this work label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

6 participants