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

fix(gnovm): correct OwnerID retrieval #3401

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions gnovm/pkg/gnolang/ownership.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,7 @@ func (oi *ObjectInfo) SetOwner(po Object) {
}

func (oi *ObjectInfo) GetOwnerID() ObjectID {
if oi.owner == nil {
return ObjectID{}
} else {
return oi.owner.GetObjectID()
}
return oi.OwnerID
}

func (oi *ObjectInfo) GetIsOwned() bool {
Expand Down
1 change: 0 additions & 1 deletion gnovm/pkg/gnolang/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ func (sv *StructValue) Copy(alloc *Allocator) *StructValue {
for i, field := range sv.Fields {
fields[i] = field.Copy(alloc)
}

return alloc.NewStruct(fields)
}

Expand Down
134 changes: 134 additions & 0 deletions gnovm/tests/files/zrealm10.gno
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,137 @@ func main() {
// "RefCount": "1"
// }
// }
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={
// "Blank": {},
// "ObjectInfo": {
// "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
// "IsEscaped": true,
// "ModTime": "4",
// "RefCount": "2"
// },
// "Parent": null,
// "Source": {
// "@type": "/gno.RefNode",
// "BlockNode": null,
// "Location": {
// "Column": "0",
// "File": "",
// "Line": "0",
// "PkgPath": "gno.land/r/test"
// }
// },
// "Values": [
// {
// "T": {
// "@type": "/gno.TypeType"
// },
// "V": {
// "@type": "/gno.TypeValue",
// "Type": {
// "@type": "/gno.DeclaredType",
// "Base": {
// "@type": "/gno.StructType",
// "Fields": [
// {
// "Embedded": false,
// "Name": "Field",
// "Tag": "",
// "Type": {
// "@type": "/gno.PrimitiveType",
// "value": "32"
// }
// }
// ],
// "PkgPath": "gno.land/r/test"
// },
// "Methods": [],
// "Name": "MyStruct",
// "PkgPath": "gno.land/r/test"
// }
// }
// },
// {
// "T": {
// "@type": "/gno.RefType",
// "ID": "gno.land/r/test.MyStruct"
// },
// "V": {
// "@type": "/gno.RefValue",
// "Hash": "f70a6738aafbe7467bfd12f749bbc2f5857dca15",
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
// }
// },
// {
// "T": {
// "@type": "/gno.FuncType",
// "Params": [],
// "Results": []
// },
// "V": {
// "@type": "/gno.FuncValue",
// "Closure": {
// "@type": "/gno.RefValue",
// "Escaped": true,
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4"
// },
// "FileName": "files/zrealm10.gno",
// "IsMethod": false,
// "Name": "init.2",
// "NativeName": "",
// "NativePkg": "",
// "PkgPath": "gno.land/r/test",
// "Source": {
// "@type": "/gno.RefNode",
// "BlockNode": null,
// "Location": {
// "Column": "1",
// "File": "files/zrealm10.gno",
// "Line": "10",
// "PkgPath": "gno.land/r/test"
// }
// },
// "Type": {
// "@type": "/gno.FuncType",
// "Params": [],
// "Results": []
// }
// }
// },
// {
// "T": {
// "@type": "/gno.FuncType",
// "Params": [],
// "Results": []
// },
// "V": {
// "@type": "/gno.FuncValue",
// "Closure": {
// "@type": "/gno.RefValue",
// "Escaped": true,
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4"
// },
// "FileName": "files/zrealm10.gno",
// "IsMethod": false,
// "Name": "main",
// "NativeName": "",
// "NativePkg": "",
// "PkgPath": "gno.land/r/test",
// "Source": {
// "@type": "/gno.RefNode",
// "BlockNode": null,
// "Location": {
// "Column": "1",
// "File": "files/zrealm10.gno",
// "Line": "14",
// "PkgPath": "gno.land/r/test"
// }
// },
// "Type": {
// "@type": "/gno.FuncType",
// "Params": [],
// "Results": []
// }
// }
// }
// ]
// }
134 changes: 134 additions & 0 deletions gnovm/tests/files/zrealm11.gno
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,137 @@ func main() {
// "RefCount": "1"
// }
// }
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={
// "Blank": {},
// "ObjectInfo": {
// "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
// "IsEscaped": true,
// "ModTime": "4",
// "RefCount": "2"
// },
// "Parent": null,
// "Source": {
// "@type": "/gno.RefNode",
// "BlockNode": null,
// "Location": {
// "Column": "0",
// "File": "",
// "Line": "0",
// "PkgPath": "gno.land/r/test"
// }
// },
// "Values": [
// {
// "T": {
// "@type": "/gno.TypeType"
// },
// "V": {
// "@type": "/gno.TypeValue",
// "Type": {
// "@type": "/gno.DeclaredType",
// "Base": {
// "@type": "/gno.StructType",
// "Fields": [
// {
// "Embedded": false,
// "Name": "Field",
// "Tag": "",
// "Type": {
// "@type": "/gno.PrimitiveType",
// "value": "32"
// }
// }
// ],
// "PkgPath": "gno.land/r/test"
// },
// "Methods": [],
// "Name": "MyStruct",
// "PkgPath": "gno.land/r/test"
// }
// }
// },
// {
// "T": {
// "@type": "/gno.RefType",
// "ID": "gno.land/r/test.MyStruct"
// },
// "V": {
// "@type": "/gno.RefValue",
// "Hash": "3045ca5b3de0ec88036e9290888e5c6e18918b74",
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
// }
// },
// {
// "T": {
// "@type": "/gno.FuncType",
// "Params": [],
// "Results": []
// },
// "V": {
// "@type": "/gno.FuncValue",
// "Closure": {
// "@type": "/gno.RefValue",
// "Escaped": true,
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4"
// },
// "FileName": "files/zrealm11.gno",
// "IsMethod": false,
// "Name": "init.2",
// "NativeName": "",
// "NativePkg": "",
// "PkgPath": "gno.land/r/test",
// "Source": {
// "@type": "/gno.RefNode",
// "BlockNode": null,
// "Location": {
// "Column": "1",
// "File": "files/zrealm11.gno",
// "Line": "10",
// "PkgPath": "gno.land/r/test"
// }
// },
// "Type": {
// "@type": "/gno.FuncType",
// "Params": [],
// "Results": []
// }
// }
// },
// {
// "T": {
// "@type": "/gno.FuncType",
// "Params": [],
// "Results": []
// },
// "V": {
// "@type": "/gno.FuncValue",
// "Closure": {
// "@type": "/gno.RefValue",
// "Escaped": true,
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4"
// },
// "FileName": "files/zrealm11.gno",
// "IsMethod": false,
// "Name": "main",
// "NativeName": "",
// "NativePkg": "",
// "PkgPath": "gno.land/r/test",
// "Source": {
// "@type": "/gno.RefNode",
// "BlockNode": null,
// "Location": {
// "Column": "1",
// "File": "files/zrealm11.gno",
// "Line": "14",
// "PkgPath": "gno.land/r/test"
// }
// },
// "Type": {
// "@type": "/gno.FuncType",
// "Params": [],
// "Results": []
// }
// }
// }
// ]
// }
21 changes: 20 additions & 1 deletion gnovm/tests/files/zrealm4.gno
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,25 @@ func main() {
// "RefCount": "1"
// }
// }
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:4]={
// "ObjectInfo": {
// "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4",
// "ModTime": "5",
// "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
// "RefCount": "1"
// },
// "Value": {
// "T": {
// "@type": "/gno.RefType",
// "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
// },
// "V": {
// "@type": "/gno.RefValue",
// "Hash": "d57ee28f5030eb8c612b374155fd545675633288",
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:5"
// }
// }
// }
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={
// "Blank": {},
// "ObjectInfo": {
Expand Down Expand Up @@ -110,7 +129,7 @@ func main() {
// "@type": "/gno.PointerValue",
// "Base": {
// "@type": "/gno.RefValue",
// "Hash": "7b9d58f40430bbbcbafd47eefb7a6dd342477f71",
// "Hash": "ef474e536e2d4229156a07798a88edc3767c0896",
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4"
// },
// "Index": "0",
Expand Down
21 changes: 20 additions & 1 deletion gnovm/tests/files/zrealm5.gno
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,25 @@ func main() {
// "RefCount": "1"
// }
// }
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:4]={
// "ObjectInfo": {
// "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4",
// "ModTime": "7",
// "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
// "RefCount": "1"
// },
// "Value": {
// "T": {
// "@type": "/gno.RefType",
// "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
// },
// "V": {
// "@type": "/gno.RefValue",
// "Hash": "115779a405a1cae45446397ea897a98a4043cbb2",
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:5"
// }
// }
// }
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={
// "Blank": {},
// "ObjectInfo": {
Expand Down Expand Up @@ -194,7 +213,7 @@ func main() {
// "@type": "/gno.PointerValue",
// "Base": {
// "@type": "/gno.RefValue",
// "Hash": "7b9d58f40430bbbcbafd47eefb7a6dd342477f71",
// "Hash": "6f8d35f40b96b3f2d4aa7afd3862c1cfbf21a43d",
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4"
// },
// "Index": "0",
Expand Down
Loading
Loading