Skip to content

JSON-RPC EthereumApi.Create panic on some contracts #71

@tymat

Description

@tymat

This simple contract works fine through EthereumApi.Create

{"id":1,"method":"EthereumApi.Create","params":[{"init":"store[this.origin()] = 10^20","body":"return lambda { string category = this.data[0] string url = this.data[1] big budget = this.data[3] string header = this.data[4] string body = this.data[5] string image = this.data[6] }","value":"300","gas":"1000000000","gasprice":"20"}]}

This one causes a panic:

{"id":1,"method":"EthereumApi.Create","params":[{"init":"store[this.origin()] = 10^20","body":"return lambda {  big to = this.data[0] big from = this.origin() big value = this.data[1] if store[from] > value { store[from] = store[from] - value store[to] = store[to] + value }}","value":"300","gas":"1000000000","gasprice":"20"}]}

Stack trace

$ ethereal
2014/05/31 09:12:50 UPnP failed write udp4: i/o timeout
2014/05/31 09:12:50 [CHAIN] Last known block height #2736
2014/05/31 09:12:50 Last block: 9b13dd99f2c6422dcf223bbaf9860950771ee2b439dc51e7ca8660b663fc533e
2014/05/31 09:12:50 Starting Ethereum GUI v0.5.0 RC11
2014/05/31 09:12:50 [JSON] Starting JSON-RPC server
2014/05/31 09:12:50 Ready and accepting connections
2014/05/31 09:12:50 [SERV] Retrieving seed nodes
2014/05/31 09:12:50 [SERV] Found DNS Go Peer: 94.242.229.217:30303
2014/05/31 09:12:50 [SERV] Adding peer (94.242.229.217:30303) 1 / 10
2014/05/31 09:12:51 [SERV] Found DNS Bootstrap Peer: 54.200.139.158:30303
2014/05/31 09:12:51 [SERV] Adding peer (54.200.139.158:30303) 2 / 10
2014/05/31 09:12:52 Requesting blockchain 9b13dd99... from peer 94.242.229.217:30303
2014/05/31 09:12:52 [PEER] [connected] (outbound) 94.242.229.217:30303  [Peer discovery | Block chain relaying | Transaction relaying]
2014/05/31 09:12:52 [GUI] Starting GUI
2014/05/31 09:12:53 [PEER] Found canonical block, returning chain from: 9b13dd99f2c6422dcf223bbaf9860950771ee2b439dc51e7ca8660b663fc533e
2014/05/31 09:12:59 [JSON] Incoming request.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x18 pc=0x41f0a96]

goroutine 27 [running]:
runtime.panic(0x4476f60, 0x4a10079)
    /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/obscuren/mutan.(*CodeGen).getArray(0x19b8ef18, 0xc210df9cc0, 0xc211b46f80, 0x0, 0x0)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/int_code.go:178 +0x166
github.com/obscuren/mutan.(*CodeGen).MakeIntCode(0x19b8ef18, 0xc210df9cc0, 0xc211b46f00)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/int_code.go:679 +0x4e6a
github.com/obscuren/mutan.(*CodeGen).MakeIntCode(0x19b8ef18, 0xc210cbe1e0, 0xc211b46900)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/int_code.go:511 +0x1664
github.com/obscuren/mutan.(*CodeGen).MakeIntCode(0x19b8ef18, 0xc21135e060, 0xc211b46900)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/int_code.go:390 +0x8f6
github.com/obscuren/mutan.(*CodeGen).MakeIntCode(0x19b8ef18, 0xc21135e0c0, 0xc211b21ea0)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/int_code.go:360 +0x1c8
github.com/obscuren/mutan.CompileStage(0x11cd2a30, 0xc211467880, 0x6c1fb00, 0x0, 0x0, ...)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/compiler.go:205 +0x41e
github.com/obscuren/mutan.Compile(0x11cd2a30, 0xc211467880, 0xc20fe4b900, 0x0, 0x0, ...)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/compiler.go:225 +0x7f
github.com/obscuren/mutan.(*CodeGen).compileLambda(0x19b707a0, 0x0, 0xc211ba3d80, 0x43b55e0, 0xc211c47d10)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/int_code.go:826 +0x9f
github.com/obscuren/mutan.(*CodeGen).MakeIntCode(0x19b707a0, 0xc211ba3de0, 0xc211b46600)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/int_code.go:764 +0x385f
github.com/obscuren/mutan.(*CodeGen).MakeIntCode(0x19b707a0, 0xc210df9000, 0xc211b21d50)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/int_code.go:360 +0x1c8
github.com/obscuren/mutan.CompileStage(0x11cd2a30, 0xc2114676e0, 0x6c1fb00, 0x0, 0x0, ...)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/compiler.go:205 +0x41e
github.com/obscuren/mutan.Compile(0x11cd2a30, 0xc2114676e0, 0x4a30300, 0x0, 0x0, ...)
    /Users/aeufemio/go/src/github.com/obscuren/mutan/compiler.go:225 +0x7f
github.com/ethereum/eth-go/ethutil.Compile(0xc211bad540, 0xb4, 0x44faa60, 0x2, 0x0, ...)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethutil/script.go:11 +0xa4
github.com/ethereum/eth-go/ethpub.(*PEthereum).createTx(0xc2109d29c0, 0xc2112d2d20, 0x40, 0x44f99a0, 0x0, ...)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethpub/pub.go:147 +0x861
github.com/ethereum/eth-go/ethpub.(*PEthereum).Create(0xc2109d29c0, 0xc2112d2d20, 0x40, 0xc211567288, 0x3, ...)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethpub/pub.go:96 +0xc8
github.com/ethereum/eth-go/ethrpc.(*EthereumApi).Create(0xc210000070, 0xc210c25070, 0xc211c47c80, 0x0, 0x0)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethrpc/packages.go:140 +0xeb
reflect.Value.call(0x4435dc0, 0x44d01d0, 0x130, 0x44fbfe0, 0x4, ...)
    /usr/local/go/src/pkg/reflect/value.go:474 +0xe0b
reflect.Value.Call(0x4435dc0, 0x44d01d0, 0x130, 0x19b70ee8, 0x3, ...)
    /usr/local/go/src/pkg/reflect/value.go:345 +0x9d
net/rpc.(*service).call(0xc2109d9000, 0xc2100847c0, 0xc2113a9050, 0xc210049200, 0xc211e0b180, ...)
    /usr/local/go/src/pkg/net/rpc/server.go:381 +0x159
created by net/rpc.(*Server).ServeCodec
    /usr/local/go/src/pkg/net/rpc/server.go:452 +0x3bb

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc211e467c4)
    /private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease023741545/go/src/pkg/runtime/sema.goc:199 +0x30
sync.(*Mutex).Lock(0xc211e467c0)
    /usr/local/go/src/pkg/sync/mutex.go:66 +0xd6
github.com/go-qml/qml.(*Window).Wait(0xc21000a210)
    /Users/aeufemio/go/src/github.com/go-qml/qml/qml.go:892 +0x9b
github.com/ethereum/go-ethereum/ethereal/ui.(*Gui).Start(0xc2109f1780, 0xc21003866d, 0x46)
    /Users/aeufemio/go/src/github.com/ethereum/go-ethereum/ethereal/ui/gui.go:102 +0x624
main.main()
    /Users/aeufemio/go/src/github.com/ethereum/go-ethereum/ethereal/ethereum.go:141 +0x9af

goroutine 3 [syscall]:
os/signal.loop()
    /usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
    /usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x31

goroutine 4 [syscall]:
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1394

goroutine 6 [syscall]:
github.com/go-qml/qml._Cfunc_applicationExec(0x4a3ab48)
    github.com/go-qml/qml/_obj/_cgo_defun.c:69 +0x31
github.com/go-qml/qml.guiLoop()
    /Users/aeufemio/go/src/github.com/go-qml/qml/bridge.go:43 +0x132
created by github.com/go-qml/qml.Init
    /Users/aeufemio/go/src/github.com/go-qml/qml/qml.go:44 +0xa0

goroutine 7 [select]:
github.com/syndtr/goleveldb/leveldb.(*DB).compactionError(0xc210083900)
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go:115 +0x1c5
created by github.com/syndtr/goleveldb/leveldb.openDB
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db.go:114 +0x402

goroutine 8 [select]:
github.com/syndtr/goleveldb/leveldb.(*DB).compaction(0xc210083900)
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go:437 +0x75f
created by github.com/syndtr/goleveldb/leveldb.openDB
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db.go:117 +0x443

goroutine 9 [select]:
github.com/syndtr/goleveldb/leveldb.(*DB).writeJournal(0xc210083900)
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db_write.go:36 +0x142
created by github.com/syndtr/goleveldb/leveldb.openDB
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db.go:118 +0x45a

goroutine 11 [select]:
github.com/ethereum/eth-go/ethchain.(*TxPool).queueHandler(0xc2100387e0)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethchain/transaction_pool.go:184 +0x2c8
created by github.com/ethereum/eth-go/ethchain.(*TxPool).Start
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethchain/transaction_pool.go:255 +0x2e

goroutine 12 [IO wait]:
net.runtime_pollWait(0x6c2aba0, 0x72, 0x0)
    /private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease023741545/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc2109d4ed0, 0x72, 0x6c28120, 0x23)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitRead(0xc2109d4ed0, 0x23, 0x6c28120)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(*netFD).accept(0xc2109d4e70, 0x45ea8d0, 0x0, 0x6c28120, 0x23)
    /usr/local/go/src/pkg/net/fd_unix.go:382 +0x2c2
net.(*TCPListener).AcceptTCP(0xc210000a20, 0x4135363, 0xb1c3f20, 0x4135363)
    /usr/local/go/src/pkg/net/tcpsock_posix.go:233 +0x47
net.(*TCPListener).Accept(0xc210000a20, 0xc2113a9010, 0xc2113a9010, 0x11cd2820, 0xc2113a9010)
    /usr/local/go/src/pkg/net/tcpsock_posix.go:243 +0x27
github.com/ethereum/eth-go/ethrpc.(*JsonRpcServer).Start(0xc2100471e0)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethrpc/server.go:42 +0x12b
created by github.com/ethereum/go-ethereum/utils.DoRpc
    /Users/aeufemio/go/src/github.com/ethereum/go-ethereum/utils/cmd.go:18 +0x180

goroutine 13 [chan receive]:
github.com/ethereum/eth-go/ethrpc.(*JsonRpcServer).exitHandler(0xc2100471e0)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethrpc/server.go:22 +0x4a
created by github.com/ethereum/eth-go/ethrpc.(*JsonRpcServer).Start
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethrpc/server.go:37 +0xd2

goroutine 14 [select]:
github.com/syndtr/goleveldb/leveldb.(*DB).compactionError(0xc210083d80)
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go:115 +0x1c5
created by github.com/syndtr/goleveldb/leveldb.openDB
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db.go:114 +0x402

goroutine 15 [select]:
github.com/syndtr/goleveldb/leveldb.(*DB).compaction(0xc210083d80)
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go:437 +0x75f
created by github.com/syndtr/goleveldb/leveldb.openDB
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db.go:117 +0x443

goroutine 16 [select]:
github.com/syndtr/goleveldb/leveldb.(*DB).writeJournal(0xc210083d80)
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db_write.go:36 +0x142
created by github.com/syndtr/goleveldb/leveldb.openDB
    /Users/aeufemio/go/src/github.com/syndtr/goleveldb/leveldb/db.go:118 +0x45a

goroutine 17 [IO wait]:
net.runtime_pollWait(0x6c2aaf8, 0x72, 0x0)
    /private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease023741545/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc210e5b220, 0x72, 0x6c28120, 0x23)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitRead(0xc210e5b220, 0x23, 0x6c28120)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(*netFD).accept(0xc210e5b1c0, 0x45ea8d0, 0x0, 0x6c28120, 0x23)
    /usr/local/go/src/pkg/net/fd_unix.go:382 +0x2c2
net.(*TCPListener).AcceptTCP(0xc210000d90, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/net/tcpsock_posix.go:233 +0x47
net.(*TCPListener).Accept(0xc210000d90, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/net/tcpsock_posix.go:243 +0x27
github.com/ethereum/eth-go.(*Ethereum).peerHandler(0xc21007d2c0, 0x6c2af70, 0xc210000d90)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethereum.go:429 +0x2d
created by github.com/ethereum/eth-go.(*Ethereum).Start
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethereum.go:356 +0x2a5

goroutine 18 [chan receive]:
github.com/ethereum/eth-go.(*Ethereum).ReapDeadPeerHandler(0xc21007d2c0)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethereum.go:338 +0x67
created by github.com/ethereum/eth-go.(*Ethereum).Start
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethereum.go:364 +0x18e

goroutine 23 [select]:
github.com/ethereum/go-ethereum/ethereal/ui.(*Gui).update(0xc2109f1780)
    /Users/aeufemio/go/src/github.com/ethereum/go-ethereum/ethereal/ui/gui.go:244 +0xdb5
created by github.com/ethereum/go-ethereum/ethereal/ui.(*Gui).showWallet
    /Users/aeufemio/go/src/github.com/ethereum/go-ethereum/ethereal/ui/gui.go:133 +0x103

goroutine 20 [IO wait]:
net.runtime_pollWait(0x6c2a9a8, 0x77, 0x0)
    /private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease023741545/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc2109d40d0, 0x77, 0x6c28120, 0x24)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitWrite(0xc2109d40d0, 0x24, 0x6c28120)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:90 +0x30
net.(*netFD).connect(0xc2109d4070, 0x0, 0x0, 0x6c29c60, 0xc2109f3020, ...)
    /usr/local/go/src/pkg/net/fd_unix.go:86 +0x166
net.(*netFD).dial(0xc2109d4070, 0x6c2afa8, 0x0, 0x6c2afa8, 0xc2100862d0, ...)
    /usr/local/go/src/pkg/net/sock_posix.go:121 +0x2fd
net.socket(0x45171e0, 0x3, 0x2, 0x1, 0x0, ...)
    /usr/local/go/src/pkg/net/sock_posix.go:91 +0x40b
net.internetSocket(0x45171e0, 0x3, 0x6c2afa8, 0x0, 0x6c2afa8, ...)
    /usr/local/go/src/pkg/net/ipsock_posix.go:136 +0x161
net.dialTCP(0x45171e0, 0x3, 0x0, 0xc2100862d0, 0xecb1bcc71, ...)
    /usr/local/go/src/pkg/net/tcpsock_posix.go:155 +0xef
net.dialSingle(0x45171e0, 0x3, 0xc2109f3b80, 0x14, 0x0, ...)
    /usr/local/go/src/pkg/net/dial.go:225 +0x3d8
net.func·015(0xecb1bcc71, 0x68335f, 0x4a31a00, 0x6fc23ac00, 0xecb1bcc71, ...)
    /usr/local/go/src/pkg/net/dial.go:158 +0xde
net.dial(0x45171e0, 0x3, 0x6c2af40, 0xc2100862d0, 0xb543e38, ...)
    /usr/local/go/src/pkg/net/fd_unix.go:40 +0x45
net.(*Dialer).Dial(0xc2109d5080, 0x45171e0, 0x3, 0xc2109f3b80, 0x14, ...)
    /usr/local/go/src/pkg/net/dial.go:165 +0x3e0
net.DialTimeout(0x45171e0, 0x3, 0xc2109f3b80, 0x14, 0x6fc23ac00, ...)
    /usr/local/go/src/pkg/net/dial.go:145 +0xaa
github.com/ethereum/eth-go.func·010()
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/peer.go:168 +0x5f
created by github.com/ethereum/eth-go.NewOutboundPeer
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/peer.go:182 +0x14f

goroutine 21 [select]:
github.com/ethereum/eth-go.(*Peer).HandleOutbound(0xc21006f300)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/peer.go:226 +0x246
created by github.com/ethereum/eth-go.(*Peer).Start
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/peer.go:507 +0x2a0

goroutine 22 [sleep]:
time.Sleep(0x1dcd6500)
    /private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease023741545/go/src/pkg/runtime/time.goc:31 +0x31
github.com/ethereum/eth-go.(*Peer).HandleInbound(0xc21006f300)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/peer.go:268 +0x5f
created by github.com/ethereum/eth-go.(*Peer).Start
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/peer.go:509 +0x2ba

goroutine 26 [IO wait]:
net.runtime_pollWait(0x6c2a900, 0x72, 0x0)
    /private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease023741545/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc2111000d0, 0x72, 0x6c28120, 0x23)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitRead(0xc2111000d0, 0x23, 0x6c28120)
    /usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(*netFD).Read(0xc211100070, 0xc210052c02, 0x5fe, 0x5fe, 0x0, ...)
    /usr/local/go/src/pkg/net/fd_unix.go:204 +0x2a0
net.(*conn).Read(0xc2113a9010, 0xc210052c02, 0x5fe, 0x5fe, 0x2, ...)
    /usr/local/go/src/pkg/net/net.go:122 +0xc5
encoding/json.(*Decoder).readValue(0xc210b8f000, 0x406e504, 0xc2114675c0, 0x55550000)
    /usr/local/go/src/pkg/encoding/json/stream.go:124 +0x4af
encoding/json.(*Decoder).Decode(0xc210b8f000, 0x44515c0, 0xc211427020, 0xd203, 0x6c1fbf0)
    /usr/local/go/src/pkg/encoding/json/stream.go:44 +0x57
net/rpc/jsonrpc.(*serverCodec).ReadRequestHeader(0xc211427000, 0xc2114675c0, 0x40690b5, 0xc210e83000)
    /usr/local/go/src/pkg/net/rpc/jsonrpc/server.go:66 +0x7b
net/rpc.(*Server).readRequestHeader(0xc2100847c0, 0x11cd28d0, 0xc211427000, 0x0, 0x0, ...)
    /usr/local/go/src/pkg/net/rpc/server.go:551 +0x9b
net/rpc.(*Server).readRequest(0xc2100847c0, 0x11cd28d0, 0xc211427000, 0xc210049200, 0xc211e0b180, ...)
    /usr/local/go/src/pkg/net/rpc/server.go:518 +0xa0
net/rpc.(*Server).ServeCodec(0xc2100847c0, 0x11cd28d0, 0xc211427000)
    /usr/local/go/src/pkg/net/rpc/server.go:437 +0x66
net/rpc.ServeCodec(0x11cd28d0, 0xc211427000)
    /usr/local/go/src/pkg/net/rpc/server.go:638 +0x3e
net/rpc/jsonrpc.ServeConn(0x11cd2820, 0xc2113a9010)
    /usr/local/go/src/pkg/net/rpc/jsonrpc/server.go:135 +0x49
created by github.com/ethereum/eth-go/ethrpc.(*JsonRpcServer).Start
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethrpc/server.go:48 +0x323

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions