gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
842 stars 343 forks source link

test store polluted by native object #2268

Open ltzmaxwell opened 4 weeks ago

ltzmaxwell commented 4 weeks ago

this happens when testing this file. it imports gno.land/p/demo/testutils, and then import std, cause an error(pre-configured manually) on math/overflow package which is not imported and used.

package main

import (
    "gno.land/p/demo/testutils"
)

func main() {
    println(testutils.TestVar1)
}

// Output:
// 123
ltzmaxwell commented 2 weeks ago

the cause for this is when conducting test with native_libs, stdlibs are loaded as well. this. The test store is kinda polluted that std libs will reference the corresponding native object which was injected priorly to the test store . in some edge cases, cause a type mismatch.