From eb52fd39065d7bc71b0db6784a2b9289cafe58ea Mon Sep 17 00:00:00 2001 From: Jamie Lokier Date: Tue, 8 Jun 2021 09:03:29 +0100 Subject: [PATCH] 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 --- nimbus/transaction/host_services.nim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nimbus/transaction/host_services.nim b/nimbus/transaction/host_services.nim index 6661b621c..51ae12c23 100644 --- a/nimbus/transaction/host_services.nim +++ b/nimbus/transaction/host_services.nim @@ -223,7 +223,13 @@ proc emitLog(host: TransactionHost, address: HostAddress, copyMem(log.data[0].addr, data, data_size.int) 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: {.pop: inline.}