Skip to content

verklegarden/evm-bloomer

Repository files navigation

evm-bloomer • Apache2/MIT licensed

An attempt to orchestrate the many blooms of the EVM

The evm-bloomer is a tool to analyse a chain's EVM support.

See the latest report here.

Usage

evm-bloomer --rpc-urls [RPC_URL...]

Example:

$ evm-bloomer --rpc-urls $rpc_oeth | jq
> {
>   "blooms": [
>     {
>       "bloom": "0xfff0fffc8000ffffffe0fffffffffffffffffffff8000000000000000000fc27",
>       "chain_id": 10,
>       "unknown_opcodes": [],
>       "version": "cancun"
>     }
>   ]
> }

Requesting a new Chain

To request a new chain please open an issue.

Test rpc url via:

cargo run -- -r "$RPC_URL" | jq

Background

While there are many different EVM chains it is wrong to assume they all run the same EVM version. Most chains except Ethereum run older EVM versions, some include custom opcodes, and some removed "random" opcodes.

This inconsistency makes it dangerous to deploy smart contracts on multiple chains without auditing the chain's EVM. Further, most chains do not properly document incompatibilities.

Note that in a smart contract's bytecode there is no distinction between code and data making it very hard to analyse it regarding unsupported opcodes.

Note

It is trivially possible to deploy a contract compiled for evm version X on a chain running EVM version Y. If an unsupported opcode is executed by the contract the EVM will revert. This can lead to smart contracts not working as intended, tested, and audited.

EVM Blooms

The maximum number of opcodes the EVM can support (assuming no "opcode extension hacks") is 256 because an opcode is of type uint8.

This means an EVM's opcode support can be encoded in a 256 bitmap or bloom.

A similar project, OpcodesBitmap created by Michael Amadi, aimed at making an EVM's bloom available onchain.

Bloom Creation

evm-bloomer creates a chain's bloom from its rpc url by simulating a contract deployment whose bytecode is a single opcode. If the rpc's EVM does not support the opcode the deployment fails, otherwise it either succeeds or returns a known error (eg stack underflow).

Contributing

All contributions are highly welcome!

Feel free to create a PR, an issue to discuss ideas, or reach out privately to merkleplant.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

An attempt to orchestrate the many blooms of the EVM

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks