Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 2.14 KB

EVM_Adapters.md

File metadata and controls

35 lines (21 loc) · 2.14 KB
created tags author
2022-01-02T13:24:59 (UTC -08:00)
rust
rustlang
rust-lang
evm_adapters

evm_adapters

Excerpt 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.

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

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.

Fuzzing support abstracted over the Evm used

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

Errors related to the EVM call execution

The account that we use to fund all the deployed contracts

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