From 9964a5577240593c036489474806b320f3a64fe0 Mon Sep 17 00:00:00 2001 From: kdeme Date: Wed, 4 Dec 2019 13:36:16 +0100 Subject: [PATCH 1/4] Replace getCurrentException --- nimbus/nimbus.nim | 6 ++---- nimbus/vm/interpreter_dispatch.nim | 5 ++--- nimbus/vm/precompiles.nim | 12 +++++------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/nimbus/nimbus.nim b/nimbus/nimbus.nim index 8eb4a32a9..237d17084 100644 --- a/nimbus/nimbus.nim +++ b/nimbus/nimbus.nim @@ -183,10 +183,8 @@ proc process*() = while nimbus.state == Running: try: poll() - except CatchableError: - debug "Exception in poll()", - exc = getCurrentException().name, - err = getCurrentExceptionMsg() + except CatchableError as e: + debug "Exception in poll()", exc = e.name, err = e.msg # Stop loop waitFor stop() diff --git a/nimbus/vm/interpreter_dispatch.nim b/nimbus/vm/interpreter_dispatch.nim index 3d3d2bece..b4d74270e 100644 --- a/nimbus/vm/interpreter_dispatch.nim +++ b/nimbus/vm/interpreter_dispatch.nim @@ -347,9 +347,8 @@ proc executeOpcodes(computation: BaseComputation) = try: computation.selectVM(fork) - except: - let msg = getCurrentExceptionMsg() - computation.setError(&"Opcode Dispatch Error msg={msg}, depth={computation.msg.depth}", true) + except CatchableError as e: + computation.setError(&"Opcode Dispatch Error msg={e.msg}, depth={computation.msg.depth}", true) computation.nextProc() if computation.isError(): diff --git a/nimbus/vm/precompiles.nim b/nimbus/vm/precompiles.nim index 818c75e76..d88f8cccf 100644 --- a/nimbus/vm/precompiles.nim +++ b/nimbus/vm/precompiles.nim @@ -358,14 +358,12 @@ proc execPrecompiles*(computation: BaseComputation, fork: Fork): bool {.inline.} of paEcMul: bn256ecMul(computation, fork) of paPairing: bn256ecPairing(computation, fork) of paBlake2bf: blake2bf(computation) - except OutOfGas: - let msg = getCurrentExceptionMsg() + except OutOfGas as e: # cannot use setError here, cyclic dependency - computation.error = Error(info: msg, burnsGas: true) - except CatchableError: - let msg = getCurrentExceptionMsg() + computation.error = Error(info: e.msg, burnsGas: true) + except CatchableError as e: if fork >= FKByzantium and precompile > paIdentity: - computation.error = Error(info: msg, burnsGas: true) + computation.error = Error(info: e.msg, burnsGas: true) else: # swallow any other precompiles errors - debug "execPrecompiles validation error", msg=msg + debug "execPrecompiles validation error", msg=e.msg From 9aae2f946308437538b73a15ca8305b4c7240674 Mon Sep 17 00:00:00 2001 From: kdeme Date: Wed, 4 Dec 2019 13:43:18 +0100 Subject: [PATCH 2/4] No more blind except --- nimbus/config.nim | 16 ++++++++-------- nimbus/rpc/whisper.nim | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nimbus/config.nim b/nimbus/config.nim index 66f55e385..0818895c9 100644 --- a/nimbus/config.nim +++ b/nimbus/config.nim @@ -209,7 +209,7 @@ proc processInteger*(v: string, o: var int): ConfigStatus = try: o = parseInt(v) result = Success - except: + except ValueError: result = ErrorParseOption proc processFloat*(v: string, o: var float): ConfigStatus = @@ -217,7 +217,7 @@ proc processFloat*(v: string, o: var float): ConfigStatus = try: o = parseFloat(v) result = Success - except: + except ValueError: result = ErrorParseOption proc processAddressPortsList(v: string, @@ -230,11 +230,11 @@ proc processAddressPortsList(v: string, var tas6: seq[TransportAddress] try: tas4 = resolveTAddress(item, IpAddressFamily.IPv4) - except: + except CatchableError: discard try: tas6 = resolveTAddress(item, IpAddressFamily.IPv6) - except: + except CatchableError: discard if len(tas4) == 0 and len(tas6) == 0: result = ErrorParseOption @@ -296,7 +296,7 @@ proc processPrivateKey(v: string, o: var PrivateKey): ConfigStatus = try: o = initPrivateKey(v) result = Success - except: + except CatchableError: result = ErrorParseOption # proc processHexBytes(v: string, o: var seq[byte]): ConfigStatus = @@ -304,7 +304,7 @@ proc processPrivateKey(v: string, o: var PrivateKey): ConfigStatus = # try: # o = fromHex(v) # result = Success -# except: +# except CatchableError: # result = ErrorParseOption # proc processHexString(v: string, o: var string): ConfigStatus = @@ -312,7 +312,7 @@ proc processPrivateKey(v: string, o: var PrivateKey): ConfigStatus = # try: # o = parseHexStr(v) # result = Success -# except: +# except CatchableError: # result = ErrorParseOption # proc processJson(v: string, o: var JsonNode): ConfigStatus = @@ -320,7 +320,7 @@ proc processPrivateKey(v: string, o: var PrivateKey): ConfigStatus = # try: # o = parseJson(v) # result = Success -# except: +# except CatchableError: # result = ErrorParseOption proc processPruneList(v: string, flags: var PruneMode): ConfigStatus = diff --git a/nimbus/rpc/whisper.nim b/nimbus/rpc/whisper.nim index f71bda86e..ea2a0510b 100644 --- a/nimbus/rpc/whisper.nim +++ b/nimbus/rpc/whisper.nim @@ -59,7 +59,7 @@ proc setupWhisperRPC*(node: EthereumNode, keys: WhisperKeys, rpcsrv: RpcServer) # this is the general behaviour we want. try: waitFor node.setPowRequirement(pow) - except: + except CatchableError: trace "setPowRequirement error occured" result = true From 5472924fff18f1fad065d3592adf3630872d0794 Mon Sep 17 00:00:00 2001 From: kdeme Date: Wed, 4 Dec 2019 14:26:55 +0100 Subject: [PATCH 3/4] Bump several vendor modules --- vendor/nim-chronicles | 2 +- vendor/nim-chronos | 2 +- vendor/nim-eth | 2 +- vendor/nim-faststreams | 2 +- vendor/nim-json-rpc | 2 +- vendor/nim-json-serialization | 2 +- vendor/nim-serialization | 2 +- vendor/nim-stew | 2 +- vendor/nimcrypto | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vendor/nim-chronicles b/vendor/nim-chronicles index 743f14cf6..81aebe6a8 160000 --- a/vendor/nim-chronicles +++ b/vendor/nim-chronicles @@ -1 +1 @@ -Subproject commit 743f14cf68f213a0cbead5e6dfc00ee3edc7fe1e +Subproject commit 81aebe6a8955b9c6c598aaf36d2c3ff8edc0e5fa diff --git a/vendor/nim-chronos b/vendor/nim-chronos index d3eac1d64..c39c06968 160000 --- a/vendor/nim-chronos +++ b/vendor/nim-chronos @@ -1 +1 @@ -Subproject commit d3eac1d64341a45547ad298dcd9fcb34523473b8 +Subproject commit c39c0696806a0ef09bc90e477ea6b177d2824699 diff --git a/vendor/nim-eth b/vendor/nim-eth index b1be96269..e6164996c 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit b1be96269435a9d49c9afed2442042a7c5130eac +Subproject commit e6164996c8e1ce1a33c17250935fc985b9120830 diff --git a/vendor/nim-faststreams b/vendor/nim-faststreams index 1e85ab915..e7a34b74f 160000 --- a/vendor/nim-faststreams +++ b/vendor/nim-faststreams @@ -1 +1 @@ -Subproject commit 1e85ab9150dd3759c86b2a6c9148f3fad3d1694c +Subproject commit e7a34b74f298eaabd7bdbe2f080bf9747ed6bfd9 diff --git a/vendor/nim-json-rpc b/vendor/nim-json-rpc index 9214b095f..fc0665f88 160000 --- a/vendor/nim-json-rpc +++ b/vendor/nim-json-rpc @@ -1 +1 @@ -Subproject commit 9214b095fb0266e5cac44804663343cd8288a84c +Subproject commit fc0665f88a4f24e9f51fe059ad4e943f3eed927e diff --git a/vendor/nim-json-serialization b/vendor/nim-json-serialization index 173c7b4a8..88b79e230 160000 --- a/vendor/nim-json-serialization +++ b/vendor/nim-json-serialization @@ -1 +1 @@ -Subproject commit 173c7b4a86e6d75a69577166526b0f5840c45003 +Subproject commit 88b79e230005d8301c3ae950abdbf8ad55e37f19 diff --git a/vendor/nim-serialization b/vendor/nim-serialization index e6c59d86b..ae60eef4e 160000 --- a/vendor/nim-serialization +++ b/vendor/nim-serialization @@ -1 +1 @@ -Subproject commit e6c59d86be74ef4a7c4ee28cf61ebb6a9e2e5972 +Subproject commit ae60eef4e8413e49fb0dbcae9a343fb479509fa0 diff --git a/vendor/nim-stew b/vendor/nim-stew index 2c9ca5dab..1c4293b3e 160000 --- a/vendor/nim-stew +++ b/vendor/nim-stew @@ -1 +1 @@ -Subproject commit 2c9ca5dabbee8f7b1eb6e24722033706f0f650dc +Subproject commit 1c4293b3e754b5ea68a188b60b192801162cd44e diff --git a/vendor/nimcrypto b/vendor/nimcrypto index e50298c7a..71b41764a 160000 --- a/vendor/nimcrypto +++ b/vendor/nimcrypto @@ -1 +1 @@ -Subproject commit e50298c7ac4d1bd6a087b38a9c27c2ae16271940 +Subproject commit 71b41764aef41de04348c645b6e7d8bfe227fda2 From 10f9f2c3bb120bfaf4eab4bed09670dda01c568a Mon Sep 17 00:00:00 2001 From: kdeme Date: Thu, 5 Dec 2019 13:01:21 +0100 Subject: [PATCH 4/4] Disable test randomStatetest159 --- tests/test_generalstate_failing.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_generalstate_failing.nim b/tests/test_generalstate_failing.nim index e401afda9..688625325 100644 --- a/tests/test_generalstate_failing.nim +++ b/tests/test_generalstate_failing.nim @@ -28,5 +28,9 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool = "RevertInCreateInInit.json", "RevertInCreateInInitCreate2.json", "InitCollision.json", + + # Failure once spotted on Travis CI Linux AMD64: + # "out of memorysubtest no: 7 failed" + # "randomStatetest159.json", ] result = name in allowedFailingGeneralStateTests