Closed
Description
openedon Aug 30, 2020
Problem
I'm updating the cadence
Homebrew formula, and it seems to build the CLI (cadence
a.k.a. runtime/cmd/main/main
) fine, but the test code panics:
$ cat test.cdc
pub fun main(): Int {
log("Hello, world!")
return 0
}
$ cadence test.cdc
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11ff038]
goroutine 1 [running]:
github.com/onflow/cadence/runtime/interpreter.recoverErrors(0xc000237ec0)
github.com/onflow/cadence/runtime/interpreter/interpreter.go:861 +0x15a
panic(0x12b6200, 0x1566630)
runtime/panic.go:969 +0x175
github.com/onflow/cadence/runtime/interpreter.HostFunctionValue.Invoke(...)
github.com/onflow/cadence/runtime/interpreter/function.go:154
github.com/onflow/cadence/runtime/interpreter.(*Interpreter).functionValueInvocationTrampoline(0xc00046a000, 0x137e980, 0xc000184000, 0xc000184650, 0x1, 0x1, 0xc00004ff50, 0x1, 0x1, 0xc00004ff60, ...)
github.com/onflow/cadence/runtime/interpreter/interpreter.go:2101 +0x31a
github.com/onflow/cadence/runtime/interpreter.(*Interpreter).VisitInvocationExpression.func1.1(0x130aa20, 0xc00040ba10, 0xc000182de0, 0x1339a7240137bd00)
github.com/onflow/cadence/runtime/interpreter/interpreter.go:2019 +0x2c8
github.com/onflow/cadence/runtime/trampoline.FlatMap.FlatMap.func1(0x130aa20, 0xc00040ba10, 0x137bd00, 0xc00040ba10)
github.com/onflow/cadence/runtime/trampoline/trampoline.go:142 +0x42
github.com/onflow/cadence/runtime/trampoline.FlatMap.FlatMap.func1(0x130aa20, 0xc00040ba10, 0x12a0fe0, 0xc000183280)
github.com/onflow/cadence/runtime/trampoline/trampoline.go:142 +0x42
github.com/onflow/cadence/runtime/trampoline.FlatMap.Resume.func1(0xc000183260, 0x12a0fe0)
github.com/onflow/cadence/runtime/trampoline/trampoline.go:154 +0x37
github.com/onflow/cadence/runtime/interpreter.(*Interpreter).runUntilNextStatement(0xc00046a000, 0x137bd00, 0xc000183260, 0x0, 0x0, 0xc000182e40)
github.com/onflow/cadence/runtime/interpreter/interpreter.go:605 +0x32
github.com/onflow/cadence/runtime/interpreter.(*Interpreter).runAllStatements(0xc00046a000, 0x137bd00, 0xc000182c20, 0x0, 0x0)
github.com/onflow/cadence/runtime/interpreter/interpreter.go:617 +0x53
github.com/onflow/cadence/runtime/interpreter.(*Interpreter).Invoke(0xc00046a000, 0x132075b, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
github.com/onflow/cadence/runtime/interpreter/interpreter.go:832 +0x114
github.com/onflow/cadence/runtime/cmd/execute.Execute(0xc0000b2030, 0x1, 0x1)
github.com/onflow/cadence/runtime/cmd/execute/execute.go:41 +0xd0
main.main()
github.com/onflow/cadence/runtime/cmd/main/main.go:29 +0x56
The trouble seems to be the call to log
. When I comment it out, the test runs fine:
$ cat test.cdc
pub fun main(): Int {
// log("Hello, world!")
return 0
}
$ cadence test.cdc && echo YES
YES
Steps to Reproduce
See above
Acceptance Criteria
I need to update the Homebrew formula with a basic "Hello, world!"-style test that should not require network access.
Context
Updating the Homebrew formula, which would otherwise be stuck at v0.6.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment