Main purpose: To verify that every execution client adheres to the specification, otherwise it would cause a positive potential fork in the chain
•
Setup: To give same input for every clients, and expect to get the same output from each client, given the same environment, prestate, hard fork activation rules
•
Important characteristics of a test:
◦
Pre-state: Entire composition of an Ethereum chain, composed of accounts with balances, nonces, code, and storage
◦
Environment: Depending on the type of the test, the environment can specify things such as the timestamp, previous RANDAO, block number, previous block hashs, total gas limit, base fee, and hard fork activation times etc.
◦
Transaction(s): Messages to the blockchain that perform actions on the blockchain, which contains the origin and destination accounts, ether value, gas limit, and data
◦
Post-state: Resulting state composed of the modified or created accounts
EVM testing - Tests Filling
•
Definition of Test filling: Process of compiling a test source code into a fixture that can be consumed by any execution client
•
Test filling vs Client unit testing: For test filling, the exact same test can be executed in any client implementation. While for client unit testing, it might vary between different client teams.
•
Feature: All test fixtures in their different formats are single JSON files, consumable for every client
EVM testing formats
•
State testing
◦
Use the state root for verification: Given the same pre-state, and the same transaction, different clients should return the same state root
▪
State root: cryptographic computation that securely commits all the contents of the state
•
Fuzzy differential state testing
◦
On top of the designed transaction, fuzzed smart contract code will be added using the tool FuzzyVM. Different clients are still expected to return the same state root.
•
Blockchain testing
◦
As not everything we check on the execution clients is part of the EVM execution, such as the execution result of the previous block, 1559 base fee etc., full block testing is also needed to verify clients' execution.