Crate evm_adapters[][src]

Expand description

evm-adapters

Abstraction over various EVM implementations via the Evm trait. Currently supported: Sputnik EVM and Evmodin.

Any implementation of the EVM trait receives fuzzing support using the proptest crate.

Sputnik’s Hooked Executor

In order to implement cheatcodes, we had to hook in EVM execution. This was done by implementing a Handler and overriding the call function, in the CheatcodeHandler

Sputnik’s Cached Forking backend

When testing, it is frequently a requirement to be able to fetch live state from e.g. Ethereum mainnet instead of redeploying the contracts locally yourself.

To assist with that, we provide 2 forking providers:

  1. ForkMemoryBackend: A simple provider which calls out to the remote node for any data that it does not have locally, and caching the result to avoid unnecessary extra requests
  2. SharedBackend: A backend which can be cheaply cloned and used in different tests, typically useful for test parallelization. Under the hood, it has a background worker which deduplicates any outgoing requests from each individual backend, while also sharing the return values and cache. This backend not in-use yet.

Modules

Abstraction over evmodin

Fuzzing support abstracted over the Evm used

Abstraction over Sputnik EVM

Structs

Blocking wrapper around an Ethers middleware, for use in synchronous contexts (powered by a tokio runtime)

Enums

Errors related to the EVM call execution

Statics

The account that we use to fund all the deployed contracts

Traits

Low-level abstraction layer for interfacing with various EVMs. Once instantiated, one only needs to specify the transaction parameters