Skip to content

Commit

Permalink
Merge pull request #432 from status-im/fix-#414
Browse files Browse the repository at this point in the history
Fix #414
  • Loading branch information
kdeme committed Dec 5, 2019
2 parents 5aa5285 + 10f9f2c commit 1e54e25
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 32 deletions.
16 changes: 8 additions & 8 deletions nimbus/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ 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 =
## Convert string to float.
try:
o = parseFloat(v)
result = Success
except:
except ValueError:
result = ErrorParseOption

proc processAddressPortsList(v: string,
Expand All @@ -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
Expand Down Expand Up @@ -296,31 +296,31 @@ 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 =
# ## Convert hexadecimal string to seq[byte].
# try:
# o = fromHex(v)
# result = Success
# except:
# except CatchableError:
# result = ErrorParseOption

# proc processHexString(v: string, o: var string): ConfigStatus =
# ## Convert hexadecimal string to string.
# try:
# o = parseHexStr(v)
# result = Success
# except:
# except CatchableError:
# result = ErrorParseOption

# proc processJson(v: string, o: var JsonNode): ConfigStatus =
# ## Convert string to JSON.
# try:
# o = parseJson(v)
# result = Success
# except:
# except CatchableError:
# result = ErrorParseOption

proc processPruneList(v: string, flags: var PruneMode): ConfigStatus =
Expand Down
6 changes: 2 additions & 4 deletions nimbus/nimbus.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion nimbus/rpc/whisper.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions nimbus/vm/interpreter_dispatch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
12 changes: 5 additions & 7 deletions nimbus/vm/precompiles.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions tests/test_generalstate_failing.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion vendor/nim-chronicles
2 changes: 1 addition & 1 deletion vendor/nim-faststreams
2 changes: 1 addition & 1 deletion vendor/nim-stew
Submodule nim-stew updated 1 files
+56 −25 stew/shims/macros.nim
2 changes: 1 addition & 1 deletion vendor/nimcrypto

0 comments on commit 1e54e25

Please sign in to comment.