Skip to content

Datatype's underline array is persisted as *uint8 pointer value #2704

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
piux2 opened this issue Aug 15, 2024 · 2 comments
Closed

Datatype's underline array is persisted as *uint8 pointer value #2704

piux2 opened this issue Aug 15, 2024 · 2 comments
Assignees
Labels
🐞 bug Something isn't working

Comments

@piux2
Copy link
Contributor

piux2 commented Aug 15, 2024

Description

Problem:

A ByteTypeValue should not be persisted as it contains the underline array. However when it is assigned to a uint8 PointerType variable , the underlien array got persisted

Testing Case:

// PKGPATH: gno.land/r/test
package test

var a0, a1 *uint8

func main() {
a := []byte("helloooooooooooooooooooooo")
a1 = &a[1]
a0 = &a[0]

}

// Realm:
// switchrealm["gno.land/r/test"]
+c[a8ada09dee16d791fd406d629fe29bb0ed084a30:4]={

  • "Data": "aGVsbG9vb29vb29vb29vb29vb29vb29vb28AAAAAAAA=", <<<< "helloooooooooooooooooooooo"
  • "List": null,
  • "ObjectInfo": {
  •    "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4",
    
  •    "IsEscaped": true,
    
  •    "ModTime": "0",
    
  •    "RefCount": "2"
    
  • }
    +}
@piux2 piux2 self-assigned this Aug 15, 2024
@piux2 piux2 changed the title Datatype is persisted as *uint8 pointer value Datatype's underline array is persisted as *uint8 pointer value Aug 15, 2024
@zivkovicmilos zivkovicmilos added the 🐞 bug Something isn't working label Sep 11, 2024
@piux2
Copy link
Contributor Author

piux2 commented Oct 14, 2024

This is not a bug. We can change the value of a0, which can modify the underlying array. Therefore, the underlying array needs to be persisted.

@thehowl
Copy link
Member

thehowl commented Nov 6, 2024

Linear re-opened this, but it's incorrect.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🐞 bug Something isn't working
Projects
Development

No branches or pull requests

3 participants