Transaction: Make `emitLog` use `Computation` to pass tests

When processing log operations on the EVMC host side, it causes incorrect
`rootHash` results in some tests.  This patch fixes the results.

The cause of these results is known: `Computation` is still doing parts of
contract scope entry/exit which need to be moved to the host.  For now, as a
temporary workaround, update logs in `Computation` as it did before.

This makes test pass when using Nimbus EVM.  (It breaks third-party EVMs when
`LOG*` ops are used, although most other tests pass.)

We can't keep this as it prevents complete host/EVM separation, but it's useful
in the current code, and it's fine to develop other functionality on top.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
This commit is contained in:
Jamie Lokier 2021-06-08 09:03:29 +01:00
parent ce0c13c4ca
commit eb52fd3906
No known key found for this signature in database
GPG Key ID: CBC25C68435C30A2
1 changed files with 7 additions and 1 deletions

View File

@ -223,7 +223,13 @@ proc emitLog(host: TransactionHost, address: HostAddress,
copyMem(log.data[0].addr, data, data_size.int) copyMem(log.data[0].addr, data, data_size.int)
log.address = address log.address = address
host.logEntries.add(log)
# TODO: Calling via `computation` is necessary to makes some tests pass.
# Here's one that passes only with this:
# tests/fixtures/eth_tests/GeneralStateTests/stRandom2/randomStatetest583.json
# We can't keep using `computation` though.
host.computation.logEntries.add(log)
#host.logEntries.add(log)
when use_evmc_glue: when use_evmc_glue:
{.pop: inline.} {.pop: inline.}