diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..45bfc44f2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,198 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +ItyFuzz is a blazing-fast hybrid fuzzer for EVM and MoveVM smart contracts that combines symbolic execution and fuzzing to find vulnerabilities. Built on LibAFL, it supports both offchain contract fuzzing and onchain fuzzing with chain forking. + +## Build & Development Commands + +### Prerequisites +- Rust nightly toolchain (2024-01-01): Install via `rustup toolchain install nightly-2024-01-01` +- The project uses a specific nightly version defined in `rust-toolchain.toml` + +### Building +```bash +# Standard build +cargo build --release + +# Debug build +cargo build + +# Build with specific features +cargo build --release --features "cmp dataflow evm print_txn_corpus full_trace" +``` + +### Running Tests +```bash +# Run all unit tests +cargo test --verbose + +# Run integration tests (offchain only) +python3 integration_test.py offchain + +# Run integration tests (onchain - requires RPC and Etherscan API keys) +python3 integration_test.py onchain + +# Run single offchain test manually +./target/release/ityfuzz evm -t 'tests/evm/reentrancy/*' -f + +# Run specific test with concolic execution +./target/release/ityfuzz evm -t 'tests/evm/concolic-1/*' --concolic --concolic-caller +``` + +### Code Quality +```bash +# Format check +cargo fmt -- --check + +# Apply formatting +cargo fmt + +# Lint (optional, commented out in CI) +cargo clippy --all-features +``` + +## Architecture + +### Core Structure + +The codebase is organized around a generic VM abstraction: + +- **`src/generic_vm/`**: Generic traits for any VM implementation + - `vm_executor.rs`: Executor trait abstraction + - `vm_state.rs`: State management abstraction + +- **`src/evm/`**: EVM-specific implementation (primary focus) + - `vm.rs`: EVM execution engine built on `revm` + - `host.rs`: Host environment for EVM execution + - `input.rs`: EVM transaction input representation + - `contract_utils.rs`: Contract deployment and initialization + +- **`src/move/`**: MoveVM implementation (requires `sui_support` feature) + +- **`src/fuzzers/`**: Fuzzer orchestration + - `evm_fuzzer.rs`: Main EVM fuzzing logic + - `move_fuzzer.rs`: MoveVM fuzzing logic + +### Key Concepts + +#### Middlewares (`src/evm/middlewares/`) +Middlewares are invoked for every opcode executed in REVM: +- **`coverage.rs`**: Instruction coverage tracking +- **`cheatcode/`**: Foundry cheatcode support for setup scripts +- **`reentrancy.rs`**: Reentrancy detection and exploitation +- **`sha3_bypass.rs`**: Symbolic SHA3 handling (enabled with `--sha3-bypass`) + +#### Oracles (`src/evm/oracles/`) +Vulnerability detection modules: +- **`erc20.rs`**: ERC20 balance manipulation detection +- **`v2_pair.rs`**: Uniswap V2 pair price manipulation +- **`arb_call.rs`**: Arbitrary call detection +- **`reentrancy.rs`**: Reentrancy vulnerability oracle +- **`selfdestruct.rs`**: Selfdestruct vulnerabilities +- **`invariant.rs`**: Echidna-style invariant testing +- **`state_comp.rs`**: State comparison oracle +- **`typed_bug.rs`**: Type-specific bug patterns + +#### Control Leak +When execution yields control to the caller mid-transaction (e.g., via external call), ItyFuzz saves the post-execution state. This enables fuzzing of reentrancy scenarios by continuing execution or injecting new transactions before the original transaction completes. + +#### Onchain Support (`src/evm/onchain/`) +- **`endpoints.rs`**: Chain configuration and RPC endpoints +- Supports ETH, BSC, Polygon, Arbitrum, Optimism, Base, and many other chains +- Fetches bytecode and storage slots on-demand during fuzzing +- Requires chain-specific RPC URLs and Etherscan API keys + +### Execution Flow + +1. **Initialization**: + - Parse CLI arguments (`src/evm/mod.rs` - `EvmArgs`) + - Load contracts via `ContractLoader` (glob patterns, addresses, or Foundry setup) + - Extract constants from bytecode via `bytecode_analyzer.rs` + - Initialize corpus with default function calls + +2. **Fuzzing Loop** (LibAFL-based): + ``` + Input → REVM Execution → Outcome: + - Reverted → Discard + - Control Leak → Save post-execution state for reentrancy + - Success → Execute Producers → Run Oracles + ``` + +3. **Feedback Collection** (`src/feedback.rs`): + - Coverage feedback (branch, instruction) + - Comparison feedback (CMP instructions for input generation) + - State comparison feedback + +4. **Scheduling** (`src/scheduler.rs`): + - Infant scheduler: prioritizes recent interesting inputs + - Power scheduling: allocates more fuzzing time to promising paths + +## Feature Flags + +Key features defined in `Cargo.toml`: + +- **`evm`**: EVM support (default) +- **`cmp`**: Comparison feedback collection (default) +- **`dataflow`**: Dataflow analysis (default) +- **`print_txn_corpus`**: Print transaction corpus (default) +- **`full_trace`**: Full execution traces (default) +- **`force_cache`**: Force caching of onchain data (default) +- **`sui_support`**: Enable MoveVM/Sui support (optional) +- **`deployer_is_attacker`**: Treat deployer as attacker +- **`print_logs`**: Enable debug logging +- **`flashloan_debug`**: Debug flashloan logic +- **`no_etherscan`**: Disable Etherscan integration + +## Common Workflows + +### Fuzzing a Local Contract +```bash +# Compile Solidity contract +solc contracts/Target.sol -o out/ --bin --abi --overwrite + +# Fuzz it +./target/release/ityfuzz evm -t 'out/*' -f +``` + +### Fuzzing Onchain Contracts +```bash +# Set RPC URL +export ETH_RPC_URL="https://eth.llamarpc.com" + +# Fuzz deployed contract with flashloan +./target/release/ityfuzz evm \ + -t 0xTargetAddress \ + -c eth \ + -b 18000000 \ + --flashloan \ + --onchain-etherscan-api-key YOUR_KEY +``` + +### Foundry Invariant Testing +```bash +# Replace: forge test --mc test/Invariant.sol:Invariant +./target/release/ityfuzz evm -m test/Invariant.sol:Invariant -- forge test +``` + +## Dependencies + +### Critical External Dependencies +- **`revm`**: Custom fork at `fuzzland/revm` - EVM execution engine with no gas metering and memory limits +- **`libafl` v0.11.2**: Fuzzing framework (exact version required) +- **`z3`**: SMT solver for symbolic execution (static-link-z3 feature) +- **`ethers`**: Ethereum utilities and RPC client +- **`foundry-cheatcodes`**: Foundry compatibility layer + +### Move/Sui Dependencies (optional) +All Move-related crates are from `fuzzland/ityfuzz-sui-fork`, enabled only with `sui_support` feature. + +## Important Notes + +- The project requires Rust nightly with specific unstable features: `downcast_unchecked`, `let_chains`, `unchecked_math`, `trait_alias` +- Sentry error tracking is initialized by default (`init_sentry()` in `main.rs`) +- Git version info is embedded at build time via `build.rs` +- The `/cache` directory is populated from GitHub releases for integration tests +- Integration tests use `timeout`/`gtimeout` to prevent hangs (30s for offchain, 5m for onchain) diff --git a/Cargo.lock b/Cargo.lock index 2ddb152ca..301080099 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -134,23 +134,6 @@ dependencies = [ "alloc-no-stdlib", ] -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - -[[package]] -name = "alloy-chains" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96c81b05c893348760f232c4cc6a6a77fd91cfb09885d4eaad25cd03bd7732e" -dependencies = [ - "num_enum 0.7.2", - "serde", - "strum 0.26.2", -] - [[package]] name = "alloy-dyn-abi" version = "0.6.4" @@ -172,27 +155,6 @@ dependencies = [ "winnow 0.6.5", ] -[[package]] -name = "alloy-eips" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "serde", - "thiserror", -] - -[[package]] -name = "alloy-genesis" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-primitives", - "alloy-rpc-types", - "serde", -] - [[package]] name = "alloy-json-abi" version = "0.6.4" @@ -205,29 +167,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "alloy-json-rpc" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-network" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-eips", - "alloy-json-rpc", - "alloy-primitives", - "alloy-rlp", - "serde", -] - [[package]] name = "alloy-primitives" version = "0.6.4" @@ -242,7 +181,6 @@ dependencies = [ "derive_arbitrary", "derive_more", "ethereum_ssz", - "getrandom 0.2.12", "hex-literal 0.4.1", "itoa", "k256 0.13.3", @@ -255,139 +193,22 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "alloy-providers" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-network", - "alloy-primitives", - "alloy-rpc-client", - "alloy-rpc-trace-types", - "alloy-rpc-types", - "alloy-transport", - "alloy-transport-http", - "async-stream", - "async-trait", - "auto_impl", - "futures", - "lru 0.12.3", - "reqwest", - "serde", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "alloy-pubsub" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-json-rpc", - "alloy-primitives", - "alloy-transport", - "bimap", - "futures", - "serde", - "serde_json", - "tokio", - "tokio-stream", - "tower", - "tracing", -] - [[package]] name = "alloy-rlp" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" dependencies = [ - "alloy-rlp-derive", "arrayvec 0.7.4", "bytes", ] -[[package]] -name = "alloy-rlp-derive" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" -dependencies = [ - "proc-macro2 1.0.79", - "quote 1.0.35", - "syn 2.0.57", -] - -[[package]] -name = "alloy-rpc-client" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "alloy-transport-http", - "futures", - "pin-project", - "reqwest", - "serde", - "serde_json", - "tokio", - "tokio-stream", - "tower", - "tracing", - "url", -] - -[[package]] -name = "alloy-rpc-trace-types" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-primitives", - "alloy-rpc-types", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-rpc-types" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "itertools 0.12.1", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-signer" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-network", - "alloy-primitives", - "async-trait", - "auto_impl", - "coins-bip32", - "coins-bip39", - "elliptic-curve 0.13.8", - "eth-keystore", - "k256 0.13.3", - "rand 0.8.5", - "thiserror", -] - [[package]] name = "alloy-sol-macro" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86ec0a47740b20bc5613b8712d0d321d031c4efc58e9645af96085d5cccfc27" dependencies = [ - "alloy-json-abi", "const-hex", "dunce", "heck 0.4.1", @@ -395,7 +216,6 @@ dependencies = [ "proc-macro-error", "proc-macro2 1.0.79", "quote 1.0.35", - "serde_json", "syn 2.0.57", "syn-solidity", "tiny-keccak", @@ -416,77 +236,12 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad09ec5853fa700d12d778ad224dcdec636af424d29fad84fb9a2f16a5b0ef09" dependencies = [ - "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", "serde", ] -[[package]] -name = "alloy-transport" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-json-rpc", - "base64 0.22.0", - "futures-util", - "serde", - "serde_json", - "thiserror", - "tokio", - "tower", - "url", - "wasm-bindgen-futures", -] - -[[package]] -name = "alloy-transport-http" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "reqwest", - "serde_json", - "tower", - "url", -] - -[[package]] -name = "alloy-transport-ipc" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-json-rpc", - "alloy-pubsub", - "alloy-transport", - "bytes", - "futures", - "interprocess", - "pin-project", - "serde_json", - "tokio", - "tokio-util 0.7.10", - "tracing", -] - -[[package]] -name = "alloy-transport-ws" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=9ac2c90#9ac2c90d58a9994d4b61c879e33c6af2739a2b4f" -dependencies = [ - "alloy-pubsub", - "alloy-transport", - "futures", - "http", - "serde_json", - "tokio", - "tokio-tungstenite", - "tracing", - "ws_stream_wasm", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -1072,19 +827,6 @@ dependencies = [ "wait-timeout", ] -[[package]] -name = "async-channel" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" -dependencies = [ - "concurrent-queue", - "event-listener 5.2.0", - "event-listener-strategy 0.5.0", - "futures-core", - "pin-project-lite", -] - [[package]] name = "async-compression" version = "0.3.15" @@ -1105,18 +847,7 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener 2.5.3", -] - -[[package]] -name = "async-lock" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" -dependencies = [ - "event-listener 4.0.3", - "event-listener-strategy 0.4.0", - "pin-project-lite", + "event-listener", ] [[package]] @@ -1157,12 +888,6 @@ name = "async-task" version = "4.3.0" source = "git+https://github.com/mystenmark/async-task?rev=4e45b26e11126b191701b9b2ce5e2346b8d7682f#4e45b26e11126b191701b9b2ce5e2346b8d7682f" -[[package]] -name = "async-task" -version = "4.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" - [[package]] name = "async-trait" version = "0.1.79" @@ -1191,21 +916,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ce4f10ea3abcd6617873bae9f91d1c5332b4a778bd9ce34d0cd517474c1de82" -[[package]] -name = "atomic" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d818003e740b63afc82337e3160717f4f63078720a810b7b903e70a5d1d2994" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "atomicwrites" version = "0.3.1" @@ -1227,16 +937,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "aurora-engine-modexp" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfacad86e9e138fca0670949eb8ed4ffdf73a55bded8887efe0863cd1a3a6f70" -dependencies = [ - "hex", - "num 0.4.1", -] - [[package]] name = "auto_impl" version = "1.2.0" @@ -1804,12 +1504,6 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" -[[package]] -name = "base64" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" - [[package]] name = "base64-simd" version = "0.8.0" @@ -1996,7 +1690,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ - "arbitrary", "serde", ] @@ -2090,22 +1783,6 @@ dependencies = [ "generic-array 0.14.7", ] -[[package]] -name = "blocking" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" -dependencies = [ - "async-channel", - "async-lock 3.3.0", - "async-task 4.7.0", - "fastrand 2.0.2", - "futures-io", - "futures-lite 2.3.0", - "piper", - "tracing", -] - [[package]] name = "blst" version = "0.3.11" @@ -2169,12 +1846,6 @@ dependencies = [ "serde", ] -[[package]] -name = "build_const" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7" - [[package]] name = "build_id" version = "0.2.1" @@ -2290,20 +1961,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "c-kzg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3130f3d8717cc02e668a896af24984d5d5d4e8bf12e278e982e0f1bd88a0f9af" -dependencies = [ - "blst", - "cc", - "glob", - "hex", - "libc", - "serde", -] - [[package]] name = "c2rust-bitfields" version = "0.18.0" @@ -2639,9 +2296,6 @@ dependencies = [ "anstyle", "clap_lex 0.7.0", "strsim 0.11.0", - "terminal_size", - "unicase", - "unicode-width", ] [[package]] @@ -2799,31 +2453,8 @@ dependencies = [ ] [[package]] -name = "coins-ledger" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e076e6e5d9708f0b90afe2dbe5a8ba406b5c794347661e6e44618388c7e3a31" -dependencies = [ - "async-trait", - "byteorder", - "cfg-if 1.0.0", - "getrandom 0.2.12", - "hex", - "hidapi-rusb", - "js-sys", - "log", - "nix 0.26.4", - "once_cell", - "thiserror", - "tokio", - "tracing", - "wasm-bindgen", - "wasm-bindgen-futures", -] - -[[package]] -name = "collectable" -version = "0.0.2" +name = "collectable" +version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08abddbaad209601e53c7dd4308d8c04c06f17bb7df006434e586a22b83be45a" @@ -2876,27 +2507,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "comfy-table" -version = "7.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c64043d6c7b7a4c58e39e7efccfdea7b93d885a795d0c054a69dbbf4dd52686" -dependencies = [ - "crossterm 0.27.0", - "strum 0.25.0", - "strum_macros 0.25.3", - "unicode-width", -] - -[[package]] -name = "concurrent-queue" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "console" version = "0.15.8" @@ -3597,16 +3207,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" dependencies = [ - "derive_builder_macro 0.12.0", -] - -[[package]] -name = "derive_builder" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" -dependencies = [ - "derive_builder_macro 0.20.0", + "derive_builder_macro", ] [[package]] @@ -3621,38 +3222,16 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "derive_builder_core" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d" -dependencies = [ - "darling 0.20.8", - "proc-macro2 1.0.79", - "quote 1.0.35", - "syn 2.0.57", -] - [[package]] name = "derive_builder_macro" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" dependencies = [ - "derive_builder_core 0.12.0", + "derive_builder_core", "syn 1.0.109", ] -[[package]] -name = "derive_builder_macro" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" -dependencies = [ - "derive_builder_core 0.20.0", - "syn 2.0.57", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -3695,19 +3274,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6e854126756c496b8c81dec88f9a706b15b875c5849d4097a3854476b9fdf94" -[[package]] -name = "dialoguer" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de" -dependencies = [ - "console", - "shell-words", - "tempfile", - "thiserror", - "zeroize", -] - [[package]] name = "diesel" version = "2.1.5" @@ -4494,7 +4060,6 @@ dependencies = [ "const-hex", "enr", "ethers-core", - "futures-channel", "futures-core", "futures-timer", "futures-util", @@ -4516,7 +4081,6 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winapi", "ws_stream_wasm", ] @@ -4529,23 +4093,14 @@ dependencies = [ "async-trait", "coins-bip32", "coins-bip39", - "coins-ledger", "const-hex", "elliptic-curve 0.13.8", "eth-keystore", "ethers-core", - "futures-executor", - "futures-util", - "home", "rand 0.8.5", - "rusoto_core", - "rusoto_kms", - "semver 1.0.22", "sha2 0.10.8", - "spki 0.7.3", "thiserror", "tracing", - "trezor-client", ] [[package]] @@ -4571,13 +4126,13 @@ dependencies = [ "serde", "serde_json", "solang-parser", - "svm-rs 0.3.5", + "svm-rs", "thiserror", "tiny-keccak", "tokio", "tracing", "walkdir", - "yansi 0.5.1", + "yansi", ] [[package]] @@ -4592,48 +4147,6 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" -[[package]] -name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" -dependencies = [ - "event-listener 4.0.3", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" -dependencies = [ - "event-listener 5.2.0", - "pin-project-lite", -] - [[package]] name = "evmole" version = "0.3.8" @@ -4715,7 +4228,7 @@ dependencies = [ "rfc6979 0.4.0", "rsa", "schemars", - "secp256k1 0.27.0", + "secp256k1", "serde", "serde_bytes", "serde_with", @@ -4838,20 +4351,6 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" -[[package]] -name = "figment" -version = "0.10.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7270677e7067213e04f323b55084586195f18308cd7546cfac9f873344ccceb6" -dependencies = [ - "atomic", - "pear", - "serde", - "toml 0.8.12", - "uncased", - "version_check", -] - [[package]] name = "findshlibs" version = "0.10.2" @@ -4950,261 +4449,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "foundry-block-explorers" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a056d4aa33a639c0aa1e9e473c25b9b191be30cbea94b31445fac5c272418ae" -dependencies = [ - "alloy-chains", - "alloy-json-abi", - "alloy-primitives", - "foundry-compilers", - "reqwest", - "semver 1.0.22", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "foundry-cheatcodes" -version = "0.2.0" -source = "git+https://github.com/foundry-rs/foundry.git?rev=617dfc28#617dfc28cb8206a0003edcf73a6f1058adaef740" -dependencies = [ - "alloy-dyn-abi", - "alloy-genesis", - "alloy-json-abi", - "alloy-primitives", - "alloy-providers", - "alloy-rpc-types", - "alloy-signer", - "alloy-sol-types", - "base64 0.22.0", - "const-hex", - "dialoguer", - "eyre", - "foundry-cheatcodes-spec", - "foundry-common", - "foundry-compilers", - "foundry-config", - "foundry-evm-core", - "foundry-wallets", - "itertools 0.12.1", - "jsonpath_lib", - "k256 0.13.3", - "p256", - "parking_lot 0.12.1", - "revm 7.2.0", - "rustc-hash", - "serde_json", - "thiserror", - "toml 0.8.12", - "tracing", - "walkdir", -] - -[[package]] -name = "foundry-cheatcodes-spec" -version = "0.2.0" -source = "git+https://github.com/foundry-rs/foundry.git?rev=617dfc28#617dfc28cb8206a0003edcf73a6f1058adaef740" -dependencies = [ - "alloy-sol-types", - "foundry-macros", - "serde", -] - -[[package]] -name = "foundry-common" -version = "0.2.0" -source = "git+https://github.com/foundry-rs/foundry.git?rev=617dfc28#617dfc28cb8206a0003edcf73a6f1058adaef740" -dependencies = [ - "alloy-dyn-abi", - "alloy-json-abi", - "alloy-json-rpc", - "alloy-primitives", - "alloy-providers", - "alloy-pubsub", - "alloy-rpc-client", - "alloy-rpc-types", - "alloy-signer", - "alloy-sol-types", - "alloy-transport", - "alloy-transport-http", - "alloy-transport-ipc", - "alloy-transport-ws", - "async-trait", - "clap 4.5.4", - "comfy-table 7.1.0", - "const-hex", - "dunce", - "ethers-core", - "ethers-middleware", - "ethers-providers", - "ethers-signers", - "eyre", - "foundry-block-explorers", - "foundry-compilers", - "foundry-config", - "glob", - "globset", - "once_cell", - "rand 0.8.5", - "reqwest", - "rustc-hash", - "semver 1.0.22", - "serde", - "serde_json", - "tempfile", - "thiserror", - "tokio", - "tower", - "tracing", - "url", - "walkdir", - "yansi 0.5.1", -] - -[[package]] -name = "foundry-compilers" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "079ada1a2093e0fec67caa15ccf018a2d1b5747c16ba1c11a28df53530eb1a5f" -dependencies = [ - "alloy-json-abi", - "alloy-primitives", - "cfg-if 1.0.0", - "dirs 5.0.1", - "dunce", - "home", - "itertools 0.12.1", - "md-5 0.10.6", - "memmap2 0.9.4", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver 1.0.22", - "serde", - "serde_json", - "sha2 0.10.8", - "solang-parser", - "svm-rs 0.4.1", - "svm-rs-builds", - "thiserror", - "tokio", - "tracing", - "walkdir", - "yansi 0.5.1", -] - -[[package]] -name = "foundry-config" -version = "0.2.0" -source = "git+https://github.com/foundry-rs/foundry.git?rev=617dfc28#617dfc28cb8206a0003edcf73a6f1058adaef740" -dependencies = [ - "Inflector", - "alloy-chains", - "alloy-primitives", - "dirs-next", - "dunce", - "eyre", - "figment", - "foundry-block-explorers", - "foundry-compilers", - "globset", - "number_prefix", - "once_cell", - "path-slash", - "regex", - "reqwest", - "revm-primitives 3.1.0", - "semver 1.0.22", - "serde", - "serde_json", - "serde_regex", - "solang-parser", - "thiserror", - "toml 0.8.12", - "toml_edit 0.21.1", - "tracing", - "walkdir", -] - -[[package]] -name = "foundry-evm-core" -version = "0.2.0" -source = "git+https://github.com/foundry-rs/foundry.git?rev=617dfc28#617dfc28cb8206a0003edcf73a6f1058adaef740" -dependencies = [ - "alloy-dyn-abi", - "alloy-genesis", - "alloy-json-abi", - "alloy-primitives", - "alloy-providers", - "alloy-rpc-types", - "alloy-sol-types", - "arrayvec 0.7.4", - "auto_impl", - "const-hex", - "derive_more", - "eyre", - "foundry-cheatcodes-spec", - "foundry-common", - "foundry-compilers", - "foundry-config", - "foundry-macros", - "futures", - "itertools 0.12.1", - "once_cell", - "parking_lot 0.12.1", - "revm 7.2.0", - "revm-inspectors", - "rustc-hash", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "foundry-macros" -version = "0.2.0" -source = "git+https://github.com/foundry-rs/foundry.git?rev=617dfc28#617dfc28cb8206a0003edcf73a6f1058adaef740" -dependencies = [ - "proc-macro-error", - "proc-macro2 1.0.79", - "quote 1.0.35", - "syn 2.0.57", -] - -[[package]] -name = "foundry-wallets" -version = "0.2.0" -source = "git+https://github.com/foundry-rs/foundry.git?rev=617dfc28#617dfc28cb8206a0003edcf73a6f1058adaef740" -dependencies = [ - "alloy-primitives", - "async-trait", - "clap 4.5.4", - "const-hex", - "derive_builder 0.20.0", - "ethers-core", - "ethers-providers", - "ethers-signers", - "eyre", - "foundry-common", - "foundry-config", - "itertools 0.12.1", - "rpassword", - "rusoto_core", - "rusoto_kms", - "serde", - "thiserror", - "tracing", -] - [[package]] name = "fragile" version = "2.0.0" @@ -5221,16 +4465,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fs4" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f9df8a11882c4e3335eb2d18a0137c505d9ca927470b0cac9c6f0ae07d28f7" -dependencies = [ - "rustix 0.38.32", - "windows-sys 0.48.0", -] - [[package]] name = "fs_extra" version = "1.3.0" @@ -5318,16 +4552,6 @@ dependencies = [ "waker-fn", ] -[[package]] -name = "futures-lite" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" -dependencies = [ - "futures-core", - "pin-project-lite", -] - [[package]] name = "futures-locks" version = "0.7.1" @@ -5452,10 +4676,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if 1.0.0", - "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -5777,7 +4999,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash 0.8.11", - "allocator-api2", "serde", ] @@ -5897,18 +5118,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" -[[package]] -name = "hidapi-rusb" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efdc2ec354929a6e8f3c6b6923a4d97427ec2f764cfee8cd4bfe890946cdf08b" -dependencies = [ - "cc", - "libc", - "pkg-config", - "rusb", -] - [[package]] name = "hkdf" version = "0.12.4" @@ -6330,12 +5539,6 @@ dependencies = [ "str_stack", ] -[[package]] -name = "inlinable_string" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" - [[package]] name = "inout" version = "0.1.3" @@ -6400,38 +5603,11 @@ checksum = "6ab388864246d58a276e60e7569a833d9cc4cd75c66e5ca77c177dad38e59996" dependencies = [ "ahash 0.7.8", "dashmap", - "hashbrown 0.12.3", - "once_cell", - "parking_lot 0.12.1", -] - -[[package]] -name = "interprocess" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f2533f3be42fffe3b5e63b71aeca416c1c3bc33e4e27be018521e76b1f38fb" -dependencies = [ - "blocking", - "cfg-if 1.0.0", - "futures-core", - "futures-io", - "intmap", - "libc", - "once_cell", - "rustc_version 0.4.0", - "spinning", - "thiserror", - "to_method", - "tokio", - "winapi", + "hashbrown 0.12.3", + "once_cell", + "parking_lot 0.12.1", ] -[[package]] -name = "intmap" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae52f28f45ac2bc96edb7714de995cffc174a395fb0abf5bff453587c980d7b9" - [[package]] name = "inventory" version = "0.3.15" @@ -6493,15 +5669,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11" @@ -6524,7 +5691,6 @@ dependencies = [ "either", "ethers", "evmole", - "foundry-cheatcodes", "glob", "handlebars", "hex", @@ -6546,9 +5712,9 @@ dependencies = [ "regex", "reqwest", "retry", - "revm 3.3.0", - "revm-interpreter 1.1.2", - "revm-primitives 1.1.2", + "revm", + "revm-interpreter", + "revm-primitives", "rlp", "rust-crypto", "semver 1.0.22", @@ -6674,7 +5840,7 @@ source = "git+https://github.com/wlmyng/jsonrpsee.git?rev=b1b300784795f6a64d0fcd dependencies = [ "anyhow", "arrayvec 0.7.4", - "async-lock 2.8.0", + "async-lock", "async-trait", "beef", "futures-channel", @@ -7036,18 +6202,6 @@ dependencies = [ "threadpool", ] -[[package]] -name = "libusb1-sys" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d0e2afce4245f2c9a418511e5af8718bcaf2fa408aefb259504d1a9cb25f27" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "libz-sys" version = "1.1.16" @@ -7111,15 +6265,6 @@ dependencies = [ "hashbrown 0.13.2", ] -[[package]] -name = "lru" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" -dependencies = [ - "hashbrown 0.14.3", -] - [[package]] name = "lz4-sys" version = "1.9.4" @@ -7218,15 +6363,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memmap2" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" -dependencies = [ - "libc", -] - [[package]] name = "memoffset" version = "0.6.5" @@ -8198,7 +7334,7 @@ version = "0.1.0" source = "git+https://github.com/MystenLabs/mysten-sim.git?rev=bd870b9a11870a2618c55ba703d58fafd41d686c#bd870b9a11870a2618c55ba703d58fafd41d686c" dependencies = [ "ahash 0.7.8", - "async-task 4.3.0", + "async-task", "bincode", "bytes", "cc", @@ -9297,29 +8433,6 @@ dependencies = [ "hmac 0.12.1", ] -[[package]] -name = "pear" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdeeaa00ce488657faba8ebf44ab9361f9365a97bd39ffb8a60663f57ff4b467" -dependencies = [ - "inlinable_string", - "pear_codegen", - "yansi 1.0.1", -] - -[[package]] -name = "pear_codegen" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bab5b985dc082b345f812b7df84e1bef27e7207b39e448439ba8bd69c93f147" -dependencies = [ - "proc-macro2 1.0.79", - "proc-macro2-diagnostics", - "quote 1.0.35", - "syn 2.0.57", -] - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -9537,17 +8650,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "piper" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" -dependencies = [ - "atomic-waker", - "fastrand 2.0.2", - "futures-io", -] - [[package]] name = "pkcs1" version = "0.4.1" @@ -9769,7 +8871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" dependencies = [ "diff", - "yansi 0.5.1", + "yansi", ] [[package]] @@ -9917,19 +9019,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "proc-macro2-diagnostics" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" -dependencies = [ - "proc-macro2 1.0.79", - "quote 1.0.35", - "syn 2.0.57", - "version_check", - "yansi 1.0.1", -] - [[package]] name = "procinfo" version = "0.4.2" @@ -9953,7 +9042,7 @@ dependencies = [ "lazy_static", "memchr", "parking_lot 0.12.1", - "protobuf 2.28.0", + "protobuf", "thiserror", ] @@ -9964,7 +9053,7 @@ source = "git+https://github.com/fuzzland/ityfuzz-sui-fork.git#a88e9595de3c04a54 dependencies = [ "anyhow", "prometheus", - "protobuf 2.28.0", + "protobuf", "workspace-hack", ] @@ -10087,17 +9176,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "protobuf" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65f4a8ec18723a734e5dc09c173e0abf9690432da5340285d536edcb4dac190" -dependencies = [ - "once_cell", - "protobuf-support", - "thiserror", -] - [[package]] name = "protobuf-src" version = "1.1.0+21.5" @@ -10107,15 +9185,6 @@ dependencies = [ "autotools", ] -[[package]] -name = "protobuf-support" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6872f4d4f4b98303239a2b5838f5bbbb77b01ffc892d627957f37a22d7cfe69c" -dependencies = [ - "thiserror", -] - [[package]] name = "quanta" version = "0.9.3" @@ -10638,7 +9707,6 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls 0.21.10", - "rustls-native-certs", "rustls-pemfile", "serde", "serde_json", @@ -10678,42 +9746,10 @@ version = "3.3.0" source = "git+https://github.com/fuzzland/revm?rev=1dead51#1dead511260119867b220b38298ddca07f406357" dependencies = [ "auto_impl", - "revm-interpreter 1.1.2", - "revm-precompile 2.0.3", - "serde", - "serde_json", -] - -[[package]] -name = "revm" -version = "7.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fd3ed4b62dc61c647552d8b781811ae25ec74d23309055077e4dfb392444d2" -dependencies = [ - "auto_impl", - "cfg-if 1.0.0", - "dyn-clone", - "revm-interpreter 3.4.0", - "revm-precompile 5.1.0", - "serde", - "serde_json", -] - -[[package]] -name = "revm-inspectors" -version = "0.1.0" -source = "git+https://github.com/paradigmxyz/evm-inspectors?rev=ba0b6ab#ba0b6ab695802c752601f17f5c941b62a067ad64" -dependencies = [ - "alloy-primitives", - "alloy-rpc-trace-types", - "alloy-rpc-types", - "alloy-sol-types", - "anstyle", - "colorchoice", - "revm 7.2.0", + "revm-interpreter", + "revm-precompile", "serde", "serde_json", - "thiserror", ] [[package]] @@ -10723,21 +9759,11 @@ source = "git+https://github.com/fuzzland/revm?rev=1dead51#1dead511260119867b220 dependencies = [ "derive_more", "enumn", - "revm-primitives 1.1.2", + "revm-primitives", "serde", "sha3 0.10.8", ] -[[package]] -name = "revm-interpreter" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0a1818f8c876b0d71a0714217c34da7df8a42c0462750768779d55680e4554" -dependencies = [ - "revm-primitives 3.1.0", - "serde", -] - [[package]] name = "revm-precompile" version = "2.0.3" @@ -10746,31 +9772,14 @@ dependencies = [ "k256 0.13.3", "num 0.4.1", "once_cell", - "revm-primitives 1.1.2", + "revm-primitives", "ripemd", - "secp256k1 0.27.0", + "secp256k1", "sha2 0.10.8", "sha3 0.10.8", "substrate-bn", ] -[[package]] -name = "revm-precompile" -version = "5.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9645a70f1df1e5bd7fa8718b9ba486fac9c3f0467aa6b58e7f590d5f6fd0f7" -dependencies = [ - "aurora-engine-modexp", - "c-kzg", - "k256 0.13.3", - "once_cell", - "revm-primitives 3.1.0", - "ripemd", - "secp256k1 0.28.2", - "sha2 0.10.8", - "substrate-bn", -] - [[package]] name = "revm-primitives" version = "1.1.2" @@ -10793,25 +9802,6 @@ dependencies = [ "sha3 0.10.8", ] -[[package]] -name = "revm-primitives" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "323ad597cf75ac9cb1d161be29fcc3562426f0278a1d04741697fca556e1ceea" -dependencies = [ - "alloy-primitives", - "auto_impl", - "bitflags 2.5.0", - "bitvec 1.0.1", - "c-kzg", - "cfg-if 1.0.0", - "dyn-clone", - "enumn", - "hashbrown 0.14.3", - "hex", - "serde", -] - [[package]] name = "rfc6979" version = "0.3.1" @@ -10935,17 +9925,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "rpassword" -version = "7.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80472be3c897911d0137b2d2b9055faf6eeac5b14e324073d83bc17b191d7e3f" -dependencies = [ - "libc", - "rtoolbox", - "windows-sys 0.48.0", -] - [[package]] name = "rsa" version = "0.8.2" @@ -10993,16 +9972,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "rtoolbox" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c247d24e63230cdb56463ae328478bd5eac8b8faa8c69461a77e8e323afac90e" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ruint" version = "1.12.3" @@ -11034,16 +10003,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" -[[package]] -name = "rusb" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45fff149b6033f25e825cbb7b2c625a11ee8e6dac09264d49beb125e39aa97bf" -dependencies = [ - "libc", - "libusb1-sys", -] - [[package]] name = "rusoto_core" version = "0.48.0" @@ -11523,17 +10482,7 @@ checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" dependencies = [ "bitcoin_hashes", "rand 0.8.5", - "secp256k1-sys 0.8.1", -] - -[[package]] -name = "secp256k1" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" -dependencies = [ - "rand 0.8.5", - "secp256k1-sys 0.9.2", + "secp256k1-sys", ] [[package]] @@ -11545,15 +10494,6 @@ dependencies = [ "cc", ] -[[package]] -name = "secp256k1-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" -dependencies = [ - "cc", -] - [[package]] name = "security-framework" version = "2.10.0" @@ -11832,16 +10772,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_regex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8136f1a4ea815d7eac4101cfd0b16dc0cb5e1fe1b8609dfd728058656b7badf" -dependencies = [ - "regex", - "serde", -] - [[package]] name = "serde_repr" version = "0.1.18" @@ -12304,15 +11234,6 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -[[package]] -name = "spinning" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d4f0e86297cad2658d92a707320d87bf4e6ae1050287f51d19b67ef3f153a7b" -dependencies = [ - "lock_api", -] - [[package]] name = "spki" version = "0.6.0" @@ -12682,39 +11603,6 @@ dependencies = [ "zip", ] -[[package]] -name = "svm-rs" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd5e919f01c9280dce59ab66296449d0e9144b8472b8892fbacf9612998b653" -dependencies = [ - "const-hex", - "dirs 5.0.1", - "fs4", - "once_cell", - "reqwest", - "semver 1.0.22", - "serde", - "serde_json", - "sha2 0.10.8", - "thiserror", - "url", - "zip", -] - -[[package]] -name = "svm-rs-builds" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bcf7abc816dd67daf88fccfb835118b0e71cf8cc3e1d0e120893e139799df6c" -dependencies = [ - "build_const", - "const-hex", - "semver 1.0.22", - "serde_json", - "svm-rs 0.4.1", -] - [[package]] name = "symbolic-common" version = "10.2.1" @@ -12722,7 +11610,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b55cdc318ede251d0957f07afe5fed912119b8c1bc5a7804151826db999e737" dependencies = [ "debugid", - "memmap2 0.5.10", + "memmap2", "stable_deref_trait", "uuid 1.8.0", ] @@ -12949,16 +11837,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix 0.38.32", - "windows-sys 0.48.0", -] - [[package]] name = "termtree" version = "0.4.1" @@ -13170,12 +12048,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "to_method" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c4ceeeca15c8384bbc3e011dbd8fccb7f068a440b752b7d9b32ceb0ca0e2e8" - [[package]] name = "tokio" version = "1.39.2" @@ -13356,7 +12228,6 @@ version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ - "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime 0.6.5", @@ -13753,20 +12624,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" -[[package]] -name = "trezor-client" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f62c95b37f6c769bd65a0d0beb8b2b003e72998003b896a616a6777c645c05ed" -dependencies = [ - "byteorder", - "hex", - "protobuf 3.3.0", - "rusb", - "thiserror", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -14826,7 +13683,7 @@ dependencies = [ "asn1-rs-impl", "assert_cmd", "async-compression", - "async-lock 2.8.0", + "async-lock", "async-recursion", "async-stream", "async-stream-impl", @@ -14946,7 +13803,7 @@ dependencies = [ "colored", "colored-diff", "combine", - "comfy-table 6.2.0", + "comfy-table", "console", "console-api 0.4.0", "console-subscriber", @@ -15000,9 +13857,9 @@ dependencies = [ "derivative", "derive-syn-parse", "derive_arbitrary", - "derive_builder 0.12.0", - "derive_builder_core 0.12.0", - "derive_builder_macro 0.12.0", + "derive_builder", + "derive_builder_core", + "derive_builder_macro", "derive_more", "determinator", "deunicode 0.4.5", @@ -15046,7 +13903,7 @@ dependencies = [ "errno 0.3.8", "error-code", "ethnum", - "event-listener 2.5.3", + "event-listener", "expect-test", "eyre", "fail", @@ -15075,7 +13932,7 @@ dependencies = [ "futures-core", "futures-executor", "futures-io", - "futures-lite 1.13.0", + "futures-lite", "futures-macro", "futures-sink", "futures-task", @@ -15186,7 +14043,7 @@ dependencies = [ "linux-raw-sys 0.3.8", "lock_api", "log", - "lru 0.10.1", + "lru", "lz4-sys", "mach", "match_opt", @@ -15196,7 +14053,7 @@ dependencies = [ "md-5 0.10.6", "md-5 0.9.1", "memchr", - "memmap2 0.5.10", + "memmap2", "memoffset 0.6.5", "memoffset 0.7.1", "merlin", @@ -15372,7 +14229,7 @@ dependencies = [ "prost-build", "prost-derive", "prost-types", - "protobuf 2.28.0", + "protobuf", "protobuf-src", "quanta", "quick-error 1.2.3", @@ -15451,8 +14308,8 @@ dependencies = [ "sct", "sec1 0.3.0", "sec1 0.7.3", - "secp256k1 0.27.0", - "secp256k1-sys 0.8.1", + "secp256k1", + "secp256k1-sys", "security-framework", "security-framework-sys", "semver 0.11.0", @@ -15661,7 +14518,7 @@ dependencies = [ "xml-rs", "xmlparser", "yaml-rust", - "yansi 0.5.1", + "yansi", "yasna", "zeroize", "zeroize_derive", @@ -15755,12 +14612,6 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" -[[package]] -name = "yansi" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" - [[package]] name = "yasna" version = "0.5.2" diff --git a/Cargo.toml b/Cargo.toml index a641e2e3d..763f39721 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -114,7 +114,8 @@ sui-types = { git = "https://github.com/fuzzland/ityfuzz-sui-fork.git", optional handlebars = "4.4" # for cheatcode middleware -foundry-cheatcodes = { git = "https://github.com/foundry-rs/foundry.git", rev = "617dfc28" } +# TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved +# foundry-cheatcodes = { git = "https://github.com/foundry-rs/foundry.git", rev = "617dfc28" } alloy-sol-types = "0.6" alloy-dyn-abi = { version = "0.6", features = ["arbitrary", "eip712"] } alloy-primitives = "0.6" @@ -128,4 +129,3 @@ tracing-subscriber = "0.3" colored = "2.0" evmole = "0.3.8" semver = "1.0.22" - diff --git a/src/evm/contract_utils.rs b/src/evm/contract_utils.rs index 4fb8ae7cf..3c68fb7f8 100644 --- a/src/evm/contract_utils.rs +++ b/src/evm/contract_utils.rs @@ -49,7 +49,7 @@ use super::{ corpus_initializer::{EnvMetadata, INITIAL_BALANCE}, host::FuzzHost, input::ConciseEVMInput, - middlewares::cheatcode::{Cheatcode, CHEATCODE_ADDRESS}, + // middlewares::cheatcode::{Cheatcode, CHEATCODE_ADDRESS}, types::EVMU256, vm::{EVMExecutor, EVMState}, }; @@ -1024,14 +1024,16 @@ impl ContractLoader { FuzzHost::new(StdScheduler::new(), work_dir), deployer, // todo: change to foundry default address ); - executor.host.set_code( - CHEATCODE_ADDRESS, - Bytecode::new_raw(Bytes::from(vec![0xfd, 0x00])), - &mut state, - ); - executor - .host - .add_middlewares(Rc::new(RefCell::new(Cheatcode::new(etherscan_api_key)))); + + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // executor.host.set_code( + // CHEATCODE_ADDRESS, + // Bytecode::new_raw(Bytes::from(vec![0xfd, 0x00])), + // &mut state, + // ); + // executor + // .host + // .add_middlewares(Rc::new(RefCell::new(Cheatcode::new(etherscan_api_key)))); // Initialize state state diff --git a/src/evm/corpus_initializer.rs b/src/evm/corpus_initializer.rs index 3de285ccb..0106492a3 100644 --- a/src/evm/corpus_initializer.rs +++ b/src/evm/corpus_initializer.rs @@ -36,7 +36,7 @@ use crate::{ bytecode_analyzer, contract_utils::{extract_sig_from_contract, to_hex_string, ABIConfig, ContractLoader}, input::{ConciseEVMInput, EVMInput, EVMInputTy}, - middlewares::cheatcode::CHEATCODE_ADDRESS, + // middlewares::cheatcode::CHEATCODE_ADDRESS, mutator::AccessPattern, onchain::{abi_decompiler::fetch_abi_evmole, flashloan::register_borrow_txn, BLACKLIST_ADDR}, presets::Preset, @@ -241,9 +241,11 @@ where contract.name, contract.balance ); - if deployed_address != CHEATCODE_ADDRESS { - self.state.add_address(&deployed_address); - } + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // if deployed_address != CHEATCODE_ADDRESS { + // self.state.add_address(&deployed_address); + // } + self.state.add_address(&deployed_address); } info!("Deployed all contracts\n"); } @@ -520,11 +522,12 @@ where } pub fn init_cheatcode_contract(&mut self) { - self.executor.host.set_code( - CHEATCODE_ADDRESS, - Bytecode::new_raw(Bytes::from(vec![0xfd, 0x00])), - self.state, - ); + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // self.executor.host.set_code( + // CHEATCODE_ADDRESS, + // Bytecode::new_raw(Bytes::from(vec![0xfd, 0x00])), + // self.state, + // ); } fn add_abi(&mut self, abi: &ABIConfig, deployed_address: EVMAddress, artifacts: &mut EVMInitializationArtifacts) { diff --git a/src/evm/host.rs b/src/evm/host.rs index 934760e9f..efd4e024d 100644 --- a/src/evm/host.rs +++ b/src/evm/host.rs @@ -56,16 +56,17 @@ use revm_primitives::{ use tracing::debug; use super::{ - middlewares::cheatcode::{ - ExpectedCallData, - ExpectedCallTracker, - ExpectedCallType, - ExpectedEmit, - ExpectedRevert, - Prank, - ERROR_PREFIX, - REVERT_PREFIX, - }, + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // middlewares::cheatcode::{ + // ExpectedCallData, + // ExpectedCallTracker, + // ExpectedCallType, + // ExpectedEmit, + // ExpectedRevert, + // Prank, + // ERROR_PREFIX, + // REVERT_PREFIX, + // }, types::EVMFuzzState, vm::{IS_FAST_CALL, MEM_LIMIT, SETCODE_ONLY}, }; @@ -233,14 +234,15 @@ where /// Depth of call stack pub call_depth: u64, - /// Prank information - pub prank: Option, - /// Expected revert information - pub expected_revert: Option, - /// Expected emits - pub expected_emits: VecDeque, - /// Expected calls - pub expected_calls: ExpectedCallTracker, + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // /// Prank information + // pub prank: Option, + // /// Expected revert information + // pub expected_revert: Option, + // /// Expected emits + // pub expected_emits: VecDeque, + // /// Expected calls + // pub expected_calls: ExpectedCallTracker, /// Assert failed message for the cheatcode pub assert_msg: Option, } @@ -310,10 +312,10 @@ where mapping_sstore_pcs_to_slot: self.mapping_sstore_pcs_to_slot.clone(), jumpi_trace: self.jumpi_trace, call_depth: self.call_depth, - prank: self.prank.clone(), - expected_emits: self.expected_emits.clone(), - expected_revert: self.expected_revert.clone(), - expected_calls: self.expected_calls.clone(), + // prank: self.prank.clone(), + // expected_emits: self.expected_emits.clone(), + // expected_revert: self.expected_revert.clone(), + // expected_calls: self.expected_calls.clone(), assert_msg: self.assert_msg.clone(), } } @@ -372,10 +374,11 @@ where mapping_sstore_pcs_to_slot: Default::default(), jumpi_trace: 37, call_depth: 0, - prank: None, - expected_revert: None, - expected_emits: VecDeque::new(), - expected_calls: ExpectedCallTracker::new(), + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // prank: None, + // expected_revert: None, + // expected_emits: VecDeque::new(), + // expected_calls: ExpectedCallTracker::new(), assert_msg: None, } } @@ -790,35 +793,39 @@ where /// Apply the prank pub fn apply_prank(&mut self, contract_caller: &EVMAddress, input: &mut CallInputs) { - if let Some(prank) = &self.prank { - if self.call_depth >= prank.depth && contract_caller == &prank.old_caller { - // At the target depth we set `msg.sender` - if self.call_depth == prank.depth { - input.context.caller = prank.new_caller; - input.transfer.source = prank.new_caller; - } - - // At the target depth, or deeper, we set `tx.origin` - if let Some(new_origin) = prank.new_origin { - self.env.tx.caller = new_origin; - } - } - } + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + + // if let Some(prank) = &self.prank { + // if self.call_depth >= prank.depth && contract_caller == + // &prank.old_caller { // At the target depth we set + // `msg.sender` if self.call_depth == prank.depth { + // input.context.caller = prank.new_caller; + // input.transfer.source = prank.new_caller; + // } + + // // At the target depth, or deeper, we set `tx.origin` + // if let Some(new_origin) = prank.new_origin { + // self.env.tx.caller = new_origin; + // } + // } + // } } /// Clean up the prank pub fn clean_prank(&mut self) { - if let Some(prank) = &self.prank { - if self.call_depth != prank.depth { - return; - } - if let Some(old_origin) = prank.old_origin { - self.env.tx.caller = old_origin; - } - if prank.single_call { - let _ = self.prank.take(); - } - } + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + + // if let Some(prank) = &self.prank { + // if self.call_depth != prank.depth { + // return; + // } + // if let Some(old_origin) = prank.old_origin { + // self.env.tx.caller = old_origin; + // } + // if prank.single_call { + // let _ = self.prank.take(); + // } + // } } /// Check expected @@ -856,48 +863,54 @@ where /// Check expected reverts fn check_expected_revert(&mut self, res: (InstructionResult, Gas, Bytes)) -> (InstructionResult, Gas, Bytes) { - // Check if we should check for reverts - if self.expected_revert.is_none() { - return res; - } - let expected_revert = self.expected_revert.as_ref().unwrap(); - if self.call_depth > expected_revert.depth { - return res; - } - let (result, gas, retdata) = res; - let mut expected_revert = self.expected_revert.take().unwrap(); - - // Check result - if matches!(result, return_ok!()) { - return ( - InstructionResult::Revert, - gas, - "Call did not revert as expected".abi_encode().into(), - ); - } + return res; - // Check revert reason - if expected_revert.reason.is_none() { - return (InstructionResult::Return, gas, retdata); - } - let expected_reason = expected_revert.reason.take().unwrap(); - let mut actual_reason = retdata.clone(); - if actual_reason.len() >= 4 && matches!(actual_reason[..4].try_into(), Ok(ERROR_PREFIX | REVERT_PREFIX)) { - if let Ok(parsed_bytes) = DynSolType::Bytes.abi_decode(&actual_reason[4..]) { - if let Some(bytes) = parsed_bytes.as_bytes().map(|b| b.to_vec()) { - actual_reason = bytes.into(); - } - } - } - if actual_reason != expected_reason { - return ( - InstructionResult::Revert, - gas, - "Revert reason mismatch".abi_encode().into(), - ); - } + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved - (InstructionResult::Return, gas, retdata) + // // Check if we should check for reverts + // if self.expected_revert.is_none() { + // return res; + // } + // let expected_revert = self.expected_revert.as_ref().unwrap(); + // if self.call_depth > expected_revert.depth { + // return res; + // } + // let (result, gas, retdata) = res; + // let mut expected_revert = self.expected_revert.take().unwrap(); + + // // Check result + // if matches!(result, return_ok!()) { + // return ( + // InstructionResult::Revert, + // gas, + // "Call did not revert as expected".abi_encode().into(), + // ); + // } + + // // Check revert reason + // if expected_revert.reason.is_none() { + // return (InstructionResult::Return, gas, retdata); + // } + // let expected_reason = expected_revert.reason.take().unwrap(); + // let mut actual_reason = retdata.clone(); + // if actual_reason.len() >= 4 && + // matches!(actual_reason[..4].try_into(), Ok(ERROR_PREFIX | + // REVERT_PREFIX)) { if let Ok(parsed_bytes) = + // DynSolType::Bytes.abi_decode(&actual_reason[4..]) { + // if let Some(bytes) = parsed_bytes.as_bytes().map(|b| + // b.to_vec()) { actual_reason = bytes.into(); + // } + // } + // } + // if actual_reason != expected_reason { + // return ( + // InstructionResult::Revert, + // gas, + // "Revert reason mismatch".abi_encode().into(), + // ); + // } + + // (InstructionResult::Return, gas, retdata) } /// Check expected emits @@ -906,58 +919,66 @@ where call: &CallInputs, res: (InstructionResult, Gas, Bytes), ) -> (InstructionResult, Gas, Bytes) { - let should_check_emits = self - .expected_emits - .iter() - .any(|expected| expected.depth == self.call_depth) && - // Ignore staticcalls - !call.is_static; - if !should_check_emits { - return res; - } + return res; + + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + + // let should_check_emits = self + // .expected_emits + // .iter() + // .any(|expected| expected.depth == self.call_depth) && + // // Ignore staticcalls + // !call.is_static; + // if !should_check_emits { + // return res; + // } - let (result, gas, retdata) = res; - // Not all emits were matched. - if self.expected_emits.iter().any(|expected| !expected.found) { - return ( - InstructionResult::Revert, - gas, - "log != expected log".abi_encode().into(), - ); - } + // let (result, gas, retdata) = res; + // // Not all emits were matched. + // if self.expected_emits.iter().any(|expected| !expected.found) { + // return ( + // InstructionResult::Revert, + // gas, + // "log != expected log".abi_encode().into(), + // ); + // } - self.expected_emits.clear(); - (result, gas, retdata) + // self.expected_emits.clear(); + // (result, gas, retdata) } /// Check expected calls fn check_expected_calls(&mut self, res: (InstructionResult, Gas, Bytes)) -> (InstructionResult, Gas, Bytes) { - // Only check expected calls at the root call - if self.call_depth > 0 { - return res; - } + return res; - let (result, gas, retdata) = res; - let expected_calls = std::mem::take(&mut self.expected_calls); - for (_, calldatas) in expected_calls { - // Loop over each address, and for each address, loop over each calldata it - // expects. - for (_, (expected, actual_count)) in calldatas { - // Grab the values we expect to see - let ExpectedCallData { count, call_type, .. } = expected; - - let failed = match call_type { - ExpectedCallType::Count => count != actual_count, - ExpectedCallType::NonCount => count > actual_count, - }; - if failed { - let msg = "expected call count mismatch"; - return (InstructionResult::Revert, gas, msg.abi_encode().into()); - } - } - } + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + + // // Only check expected calls at the root call + // if self.call_depth > 0 { + // return res; + // } + + // let (result, gas, retdata) = res; + // let expected_calls = std::mem::take(&mut self.expected_calls); + // for (_, calldatas) in expected_calls { + // // Loop over each address, and for each address, loop over each + // calldata it // expects. + // for (_, (expected, actual_count)) in calldatas { + // // Grab the values we expect to see + // let ExpectedCallData { count, call_type, .. } = expected; + + // let failed = match call_type { + // ExpectedCallType::Count => count != actual_count, + // ExpectedCallType::NonCount => count > actual_count, + // }; + // if failed { + // let msg = "expected call count mismatch"; + // return (InstructionResult::Revert, gas, + // msg.abi_encode().into()); } + // } + // } - (result, gas, retdata) + // (result, gas, retdata) } } diff --git a/src/evm/middlewares/mod.rs b/src/evm/middlewares/mod.rs index 49b1f16c9..4cc2814b5 100644 --- a/src/evm/middlewares/mod.rs +++ b/src/evm/middlewares/mod.rs @@ -1,5 +1,6 @@ pub mod call_printer; -pub mod cheatcode; +// TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved +// pub mod cheatcode; pub mod coverage; pub mod middleware; pub mod reentrancy; diff --git a/src/evm/onchain/endpoints.rs b/src/evm/onchain/endpoints.rs index 31e12baa4..32153ba02 100644 --- a/src/evm/onchain/endpoints.rs +++ b/src/evm/onchain/endpoints.rs @@ -228,7 +228,7 @@ impl Chain { Chain::ETH => "https://eth.merkle.io", Chain::GOERLI => "https://rpc.ankr.com/eth_goerli", Chain::SEPOLIA => "https://rpc.ankr.com/eth_sepolia", - Chain::BSC => "https://bnb.api.onfinality.io/public", + Chain::BSC => "https://bsc-rpc.publicnode.com", Chain::CHAPEL => "https://rpc.ankr.com/bsc_testnet_chapel", Chain::POLYGON => "https://polygon.llamarpc.com", Chain::MUMBAI => "https://rpc-mumbai.maticvigil.com/", @@ -749,7 +749,7 @@ impl OnChainConfig { { return None; } - + let endpoint = if self.etherscan_base.contains("/v2/api") { format!( "{}?chainid={}&module=contract&action=getabi&address={:?}&format=json&apikey={}", @@ -774,33 +774,44 @@ impl OnChainConfig { } ) }; - + info!("fetching abi from {}", endpoint); - match self.get(endpoint.clone()) { - Some(resp) => { - let json = serde_json::from_str::(&resp); - match json { - Ok(json) => { - let result_parsed = json["result"].as_str(); - match result_parsed { - Some(result) => { - if result == "Contract source code not verified" { - None - } else { - Some(result.to_string()) - } - } - _ => None, - } - } - Err(_) => None, - } + for attempt in 0..3 { + if attempt > 0 { + std::thread::sleep(std::time::Duration::from_secs(1)); } - None => { - error!("failed to fetch abi from {}", endpoint); - None + + let resp = match self.get(endpoint.clone()) { + Some(resp) => resp, + None => continue, // Request failed, retry + }; + + let json: Value = match serde_json::from_str(&resp) { + Ok(json) => json, + Err(_) => continue, // JSON parse error, retry + }; + + let status_ok = json["status"].as_str() == Some("1"); + let message_ok = json["message"].as_str() == Some("OK"); + if !status_ok || !message_ok { + continue; // status/message not OK, retry } + + let result = match json["result"].as_str() { + Some(result) => result, + None => continue, // result field missing or invalid, retry + }; + + if result == "Contract source code not verified" { + return None; + } + + // debug!("abi fetched: {}", result); + return Some(result.to_string()); } + + error!("failed to fetch abi from {} after 3 attempts", endpoint); + None } fn blockscout_fetch_abi_uncached(&self, address: EVMAddress) -> Option { @@ -854,14 +865,18 @@ impl OnChainConfig { .build() .expect("Failed to create HTTP client"); - return client + debug!(">> {} {}", self.endpoint_url, data); + let resp = client .post(&self.endpoint_url) .header("Content-Type", "application/json") - .body(data) + .body(data.clone()) .send() .ok() - .and_then(|resp| resp.text().ok()) - .and_then(|resp| serde_json::from_str(&resp).ok()) + .and_then(|resp| resp.text().ok())?; + debug!("<< {}", resp); + + return serde_json::from_str(&resp) + .ok() .and_then(|json: Value| json.get("result").cloned()); } // Handling IPC request @@ -1148,12 +1163,13 @@ impl OnChainConfig { return "".to_string(); } - info!("fetching code from {}", hex::encode(address)); + info!("eth_getCode 0x{}", hex::encode(address)); let resp_string = { let mut params = String::from("["); params.push_str(&format!("\"0x{:x}\",", address)); params.push_str(&format!("\"{}\"", self.block_number)); + // params.push_str("\"latest\""); params.push(']'); let resp = self._request("eth_getCode".to_string(), params); match resp { @@ -1161,7 +1177,10 @@ impl OnChainConfig { let code = resp.as_str().unwrap(); code.to_string() } - None => "".to_string(), + None => { + info!("empty code for address 0x{:x}", address); + "".to_string() + } } } .trim_start_matches("0x") @@ -1226,20 +1245,21 @@ impl OnChainConfig { if self.pair_cache.contains_key(&EVMAddress::from_str(&token).unwrap()) { return self.pair_cache[&EVMAddress::from_str(&token).unwrap()].clone(); } - info!("fetching pairs for {token}"); let url = if is_pegged { format!("https://pairs-all.infra.fuzz.land/single_pair/{network}/{token}/{weth}") } else { format!("https://pairs-all.infra.fuzz.land/pairs/{network}/{token}") }; - // info!("{url}"); + debug!(">> {url}"); let resp: Value = reqwest::blocking::get(url).unwrap().json().unwrap(); + debug!("<< {}", resp.to_string()); let mut pairs: Vec = Vec::new(); if let Some(resp_pairs) = resp.as_array() { for item in resp_pairs { let pair = item["pair"].as_str().unwrap().to_string(); let code = self.get_contract_code(EVMAddress::from_str(&pair).unwrap(), false); if code.is_empty() { + info!("skip pair {pair} due to empty code"); continue; } let token0 = item["token0"].as_str().unwrap().to_string(); @@ -1279,6 +1299,8 @@ impl OnChainConfig { } self.pair_cache .insert(EVMAddress::from_str(&token).unwrap(), pairs.clone()); + + info!(?pairs, "fetched {} pairs for {}", pairs.len(), token); pairs } diff --git a/src/evm/onchain/mod.rs b/src/evm/onchain/mod.rs index 458c5bf07..284510d95 100644 --- a/src/evm/onchain/mod.rs +++ b/src/evm/onchain/mod.rs @@ -34,7 +34,7 @@ use crate::{ host::FuzzHost, input::{EVMInput, EVMInputTy}, middlewares::{ - cheatcode::CHEATCODE_ADDRESS, + // cheatcode::CHEATCODE_ADDRESS, middleware::{add_corpus, Middleware, MiddlewareType}, }, mutator::AccessPattern, @@ -447,9 +447,11 @@ impl OnChain { host.add_hashes(address_h160, parsed_abi.iter().map(|abi| abi.function).collect()); } let target = if is_proxy_call { caller } else { address_h160 }; - if target != CHEATCODE_ADDRESS { - state.add_address(&target); - } + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // if target != CHEATCODE_ADDRESS { + // state.add_address(&target); + // } + state.add_address(&target); // notify flashloan and blacklisting flashloan addresses { diff --git a/src/evm/oracles/invariant.rs b/src/evm/oracles/invariant.rs index 18334a4d3..340ed08a4 100644 --- a/src/evm/oracles/invariant.rs +++ b/src/evm/oracles/invariant.rs @@ -12,7 +12,7 @@ use revm_primitives::Bytecode; use crate::{ evm::{ input::{ConciseEVMInput, EVMInput}, - middlewares::cheatcode::CHEATCODE_ADDRESS, + // middlewares::cheatcode::CHEATCODE_ADDRESS, oracle::EVMBugResult, oracles::INVARIANT_BUG_IDX, types::{EVMAddress, EVMFuzzState, EVMOracleCtx, EVMQueueExecutor, EVMU256}, @@ -115,14 +115,16 @@ impl // 0x6661696c65640000000000000000000000000000000000000000000000000000 // if the invariant is violated in cheatcode cotract. // @shou: tbh, i feel its dumb and wasteful - new_state - .get(&CHEATCODE_ADDRESS) - .map(|data| { - data.get(&self.failed_slot) - .map(|v| v == &EVMU256::from(1)) - .unwrap_or(false) - }) - .unwrap_or(false) + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // new_state + // .get(&CHEATCODE_ADDRESS) + // .map(|data| { + // data.get(&self.failed_slot) + // .map(|v| v == &EVMU256::from(1)) + // .unwrap_or(false) + // }) + // .unwrap_or(false) + false } { continue; diff --git a/src/evm/tokens/uniswap.rs b/src/evm/tokens/uniswap.rs index 36556158e..4b1ce7082 100644 --- a/src/evm/tokens/uniswap.rs +++ b/src/evm/tokens/uniswap.rs @@ -9,7 +9,7 @@ use std::{ use itertools::Itertools; use lazy_static::lazy_static; use revm_primitives::Bytecode; -use tracing::{info, warn}; +use tracing::{debug, info, warn}; use super::{ get_uniswap_info, @@ -158,6 +158,7 @@ fn get_pair(chain: &mut Box, token: &str, is_pegged: bool) -> V let token = token.to_lowercase(); info!("fetching pairs for {token}"); if token == chain.get_weth() { + debug!("token {} is weth, returning empty pairs", token); return vec![]; } let pegged_tokens = chain.get_pegged_token(); @@ -228,7 +229,10 @@ fn get_pegged_next_hop(chain: &mut Box, token: &str) -> PairDat token1: "".to_string(), }; } - let mut peg_info = get_pair(chain, token, true) + + let pairs = get_pair(chain, token, true); + debug!(%token, ?pairs, "get_pair (pegged)"); + let mut peg_info = pairs .first() .expect("Unexpected RPC error, consider setting env ") .clone(); diff --git a/src/fuzzers/evm_fuzzer.rs b/src/fuzzers/evm_fuzzer.rs index bac6f5081..6f7074380 100644 --- a/src/fuzzers/evm_fuzzer.rs +++ b/src/fuzzers/evm_fuzzer.rs @@ -40,7 +40,7 @@ use crate::{ input::{ConciseEVMInput, EVMInput}, middlewares::{ call_printer::CallPrinter, - cheatcode::Cheatcode, + // cheatcode::Cheatcode, coverage::{Coverage, EVAL_COVERAGE}, middleware::Middleware, reentrancy::ReentrancyTracer, @@ -110,7 +110,9 @@ pub fn evm_fuzzer( // **Note**: cheatcode should be the first middleware because it consumes the // step if it is a call to cheatcode_address, and this step should not be // visible to other middlewares. - fuzz_host.add_middlewares(Rc::new(RefCell::new(Cheatcode::new(&config.etherscan_api_key)))); + // TODO: enable cheatcode when https://github.com/matter-labs/zksync-era/issues/4581 is resolved + // fuzz_host.add_middlewares(Rc::new(RefCell::new(Cheatcode::new(&config. + // etherscan_api_key)))); macro_rules! create_onchain { ($onchain: expr) => {{