mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-03-03 21:30:53 +00:00
This provides "host services", functions provided by the application to an EVM. They are a key part of EVMC compatibility, but we will switch to using these with "native" EVM as well. These are functions like `getStorage`, `setStorage` and `emitLog` for accessing the account state, because the EVM is not allowed direct access to the database. This code is adapted from `nimbus/vm/evmc_host.nim` and other places, but there is more emphasis on being host-side only, no dependency on the EVM or `Computation` type. It uses `TransactionHost` and types in `host_types`. These host services have two goals: To be compatible with EVMC, and to be a good way for the Nimbus EVM to access the data it needs. In our new Nimbus internal architecture, the EVM will only access the databases and other application state via these host service functions. The reason for containing the EVM like this, even "native" EVM, is that having one good interface to the data makes it a lot easier to change how the database works, which is on the roadmap. These functions almost have EVMC signatures, but they are not binary compatible with EVMC. (Binary compatibility is provided by another module). It would be fine for Nimbus EVM to call these functions directly when linked directly. Signed-off-by: Jamie Lokier <jamie@shareable.org>