nimbus-eth1/nimbus/vm
Jamie Lokier 537cac1bf5
EVM: Move where `continuation` is cleared to fix a potential stall
This fixes a bug spotted by @mjfh that was introduced by commit 2a7ccceb:

    try:
      if not c.continuation.isNil:
        (c.continuation)()
        c.continuation = nil
      c.selectVM(fork)
    except CatchableError as e:
      ...

The call to `(c.continuation)()` was moved by 2a7ccceb inside the `try` so
that, like all the Op functions do already, if the continuation raises, the
interpreter's general catch turns the exception into a an error status result.

But if the continuation raises an exception, `continuation` is not cleared in
the next line, and at the next resumption the continuation is called again.
It may loop doing this.

This doesn't currently happen because the continuations don't really raise, but
it's still a correctness issue.

This fix also allows a continuation to spawn a second continuation, if it
encounters a second suspension point.  This also doesn't happen currently,
but the pattern will become useful with async EVM.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-27 12:16:37 +01:00
..
interpreter eip2718: test_blockchain_json pass test 2021-05-15 18:09:35 +07:00
blake2b_f.nim implement EIP-152 2019-11-12 15:51:48 +00:00
blscurve.nim bump submodules 2021-01-20 11:50:07 +07:00
code_stream.nim reset explicit import paths for local modules 2021-04-01 12:53:22 +01:00
computation.nim EVM: Move where `continuation` is cleared to fix a potential stall 2021-05-27 12:16:37 +01:00
evmc_api.nim reset explicit import paths for local modules 2021-04-01 12:53:22 +01:00
evmc_helpers.nim evmc host implementation 2020-01-23 18:07:44 +02:00
evmc_host.nim EVMC: Small stacks when using EVMC, closes #575 (segfaults) 2021-04-27 05:53:32 +01:00
interpreter.nim EVM: Small patch that reduces EVM stack usage to almost nothing 2021-04-13 23:35:26 +01:00
interpreter_dispatch.nim EVM: Move where `continuation` is cleared to fix a potential stall 2021-05-27 12:16:37 +01:00
map_to_curve_g1.nim more eip2537 cleanup 2020-12-02 15:15:58 +07:00
memory.nim reset explicit import paths for local modules 2021-04-01 12:53:22 +01:00
message.nim reset explicit import paths for local modules 2021-04-01 12:53:22 +01:00
precompiles.nim disable EIP-2537: Precompile for BLS12-381 curve operations 2021-05-17 01:29:03 +07:00
stack.nim reset explicit import paths for local modules 2021-04-01 12:53:22 +01:00
state.nim drop PublicNetwork enum usage and replace it with NetworkId 2021-05-20 14:04:16 +07:00
state_transactions.nim Transaction: Prepare txRefundGas to support txCallEvm 2021-05-03 19:51:20 +01:00
transaction_tracer.nim reset explicit import paths for local modules 2021-04-01 12:53:22 +01:00
types.nim EVMC: Small stacks when using EVMC, closes #575 (segfaults) 2021-04-27 05:53:32 +01:00