Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bshastry committed Dec 6, 2023
1 parent 4643ced commit dbe1c4d
Show file tree
Hide file tree
Showing 8 changed files with 4,085 additions and 96 deletions.
829 changes: 740 additions & 89 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion crates/test-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ colored = "2.0"

# used by revm; we need to force the js feature for wasm support
getrandom = { version = "0.2.8", features = ["js"] }
revm = "3.0"
revm = "3.5.0"
alloy-primitives = { version = "0.4" }
13 changes: 7 additions & 6 deletions crates/test-runner/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bytes::Bytes;
use alloy_primitives::{Address, Bytes};
use colored::Colorize;
use revm::primitives::{AccountInfo, Bytecode, Env, ExecutionResult, TransactTo, B160, U256};
use std::fmt::Display;
use revm::primitives::{AccountInfo, Bytecode, Env, ExecutionResult, TransactTo, U256};
use std::{fmt::Display, str::FromStr};

#[derive(Debug, Default)]
pub struct TestSink {
Expand Down Expand Up @@ -66,11 +66,12 @@ impl Display for TestSink {
}

pub fn execute(name: &str, bytecode: &str, sink: &mut TestSink) -> bool {
let bytecode = Bytecode::new_raw(Bytes::copy_from_slice(&hex::decode(bytecode).unwrap()));
let bytecode = Bytecode::new_raw(alloy_primitives::Bytes(
Bytes::copy_from_slice(&hex::decode(bytecode).unwrap()).into()));

let mut database = revm::InMemoryDB::default();
let test_address = B160::from(42);
let test_info = AccountInfo::new(U256::ZERO, 0, bytecode);
let test_address = Address::from_str("42").unwrap();
let test_info = AccountInfo::new(U256::ZERO, 0, bytecode.hash_slow(), bytecode);
database.insert_account_info(test_address, test_info);

let mut env = Env::default();
Expand Down
4 changes: 4 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target
corpus
artifacts
coverage
Loading

0 comments on commit dbe1c4d

Please sign in to comment.