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

panic: interface conversion: interface {} is nil, not stdlibs.ExecContext #793

Closed
r3v4s opened this issue May 2, 2023 · 2 comments
Closed
Assignees
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@r3v4s
Copy link
Contributor

r3v4s commented May 2, 2023

panic: interface conversion: interface {} is nil, not stdlibs.ExecContext

Description

if package A has std.GetOrigPkgAddr() and package B imports package A => panic happens

Your environment

  • OS and version: macOS Ventura 13.3.1
  • version of gno: latest
  • branch that causes this issue (with the commit hash): latest master

Steps to reproduce

package A

image

  • source at left, test case at right (which runs fine)

package B

package nested2

import (
	"std"
	"gno.land/p/demo/nested1" // panic
)
panic: interface conversion: interface {} is nil, not stdlibs.ExecContext [recovered]
        panic: interface conversion: interface {} is nil, not stdlibs.ExecContext

goroutine 1 [running]:
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow.func1()
        /Users/n3wbie/gno/gnovm/pkg/gnolang/preprocess.go:2851 +0x138
panic({0x101392fc0, 0x14000503ce0})
        /Users/n3wbie/.go/src/runtime/panic.go:884 +0x204
github.com/gnolang/gno/gnovm/stdlibs.InjectPackage.func15(0x140002ca5a0?)
        /Users/n3wbie/gno/gnovm/stdlibs/stdlibs.go:296 +0x290
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).doOpCallNativeBody(...)
        /Users/n3wbie/gno/gnovm/pkg/gnolang/op_call.go:161
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).Run(0x140002ca5a0)
        /Users/n3wbie/gno/gnovm/pkg/gnolang/machine.go:1023 +0x150
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runDeclaration(0x140002ca5a0, {0x101469540?, 0x140003b6e00?})
        /Users/n3wbie/gno/gnovm/pkg/gnolang/machine.go:722 +0x180
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runFiles.func1(0x1400059cb00, {0x101469540?, 0x140003b6e00})
        /Users/n3wbie/gno/gnovm/pkg/gnolang/machine.go:490 +0x2c0
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).runFiles(0x140002ca5a0, {0x1400030aa88, 0x1, 0x1})
        /Users/n3wbie/gno/gnovm/pkg/gnolang/machine.go:504 +0x69c
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunFiles(...)
        /Users/n3wbie/gno/gnovm/pkg/gnolang/machine.go:377
github.com/gnolang/gno/gnovm/pkg/gnolang.(*Machine).RunMemPackage(0x140002ca5a0, 0x1400009d980, 0x1)
        /Users/n3wbie/gno/gnovm/pkg/gnolang/machine.go:234 +0x1c8
github.com/gnolang/gno/gnovm/tests.TestStore.func1({0x14000130781, 0x17})
        /Users/n3wbie/gno/gnovm/tests/imports.go:433 +0x296c
github.com/gnolang/gno/gnovm/pkg/gnolang.(*defaultStore).GetPackage(0x140001481b0, {0x14000130781, 0x17}, 0x47?)
        /Users/n3wbie/gno/gnovm/pkg/gnolang/store.go:162 +0x184
github.com/gnolang/gno/gnovm/pkg/gnolang.tryPredefine({0x10146fa58, 0x140001481b0}, {0x10146de38, 0x140000cf8c0}, {0x101469450, 0x14000442a00?})
        /Users/n3wbie/gno/gnovm/pkg/gnolang/preprocess.go:2967 +0x10c
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow2({0x10146fa58, 0x140001481b0}, {0x10146de38, 0x140000cf8c0}, {0x101469450?, 0x14000442a00?}, 0x200?)
        /Users/n3wbie/gno/gnovm/pkg/gnolang/preprocess.go:2870 +0xe8
github.com/gnolang/gno/gnovm/pkg/gnolang.predefineNow({0x10146fa58, 0x140001481b0}, {0x10146de38, 0x140000cf8c0}, {0x101469450, 0x14000442a00})
        /Users/n3wbie/gno/gnovm/pkg/gnolang/preprocess.go:2859 +0xd0
github.com/gnolang/gno/gnovm/pkg/gnolang.PredefineFileSet({0x10146fa58, 0x140001481b0}, 0x140001602c0, 0x1400000e948)
        /Users/n3wbie/gno/gnovm/pkg/gnolang/preprocess.go:38 +0x628

Expected behaviour

should return g17rgsdnfxzza0sdfsdma37sdwxagsz378833ca4, I think

Actual behaviour

panic

Additional

related #634 #656 #757

@ajnavarro ajnavarro added the bug label May 2, 2023
@ajnavarro ajnavarro added 🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related and removed bug labels May 15, 2023
@moul moul moved this to 🏆 Needed for Launch in 🚀 The Launch [DEPRECATED] Sep 5, 2023
@moul moul added this to the 🚀 main.gno.land milestone Sep 6, 2023
@dongwon8247 dongwon8247 moved this to Blocked By / Issues / Questions in 🤝🏻 Partner: Onbloc Nov 12, 2023
@notJoon notJoon moved this from Blocked By / Questions to In Review in 🤝🏻 Partner: Onbloc Nov 13, 2023
@notJoon notJoon moved this from In Review to Todo in 🤝🏻 Partner: Onbloc Nov 13, 2023
@r3v4s r3v4s moved this from Todo to Blocked by / Wishlist / Issues in 🤝🏻 Partner: Onbloc May 9, 2024
@notJoon
Copy link
Member

notJoon commented Aug 15, 2024

When I reproduced and executed the steps describe as is, the value stored in the variable opa (declared in nested1 package) is now correctly output from the file in the nested2 directory.

It seems that it has been fixed by another PR now, but I'm not sure which PR it is. the directory structure I tested as follows:

.
└── examples/
    └── gno.land/
        ├── nested1/
        │   ├── foo.gno
        │   ├── foo_test.gno
        │   └── gno.mod
        └── nested2/
            ├── bar.gno
            ├── bar_test.gno
            └── gno.mod

Test Result

=== RUN   TestShouldReturnOPA
opa: g1uyjq8mwwn4rw6g42tnhjryawma7q8x7sqjcef2
--- PASS: TestShouldReturnOPA (0.00s)
ok      examples/gno.land/p/demo/nested2 

cc: @r3v4s @gnolang/tech-staff

@thehowl
Copy link
Member

thehowl commented Oct 4, 2024

Possibly related and fixed by #2856. Feel free to re-open if you can replicate; but we need better replication steps. (What commands did you run? Can you make a txtar?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Development

No branches or pull requests

6 participants