Skip to content

Commit

Permalink
Compatible with hexadecimal and decimal block strings
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAWM committed Sep 8, 2023
1 parent c3c77da commit 35f807c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 14 deletions.
51 changes: 40 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ name = "ityfuzz"
harness = false

[features]
default = ["cmp", "dataflow", "evm", "print_txn_corpus", "full_trace", "memory_limit"]
default = [
"cmp",
"dataflow",
"evm",
"print_txn_corpus",
"full_trace",
"memory_limit",
"flashloan_v2",
]
evm = []
cmp = []
dataflow = []
Expand All @@ -29,7 +37,16 @@ force_cache = []
use_presets = []
print_logs = []
z3_debug = []
sui_support = ["dep:move-binary-format", "dep:move-core-types", "dep:move-stdlib", "dep:move-vm-runtime", "dep:move-vm-types", "dep:sui-move-natives-latest", "dep:sui-protocol-config", "dep:sui-types"]
sui_support = [
"dep:move-binary-format",
"dep:move-core-types",
"dep:move-stdlib",
"dep:move-vm-runtime",
"dep:move-vm-types",
"dep:sui-move-natives-latest",
"dep:sui-protocol-config",
"dep:sui-types",
]
debug = []
memory_limit = [
"revm-primitives/memory_limit",
Expand All @@ -39,9 +56,18 @@ memory_limit = [

[dependencies]
bytes = { version = "1.2.1", features = ["serde"] }
revm = { path = "./externals/revm/crates/revm", features = ["no_gas_measuring", "serde"] }
revm-primitives = { path = "./externals/revm/crates/primitives", features = ["no_gas_measuring", "serde"] }
revm-interpreter = { path = "./externals/revm/crates/interpreter", features = ["no_gas_measuring", "serde"] }
revm = { path = "./externals/revm/crates/revm", features = [
"no_gas_measuring",
"serde",
] }
revm-primitives = { path = "./externals/revm/crates/primitives", features = [
"no_gas_measuring",
"serde",
] }
revm-interpreter = { path = "./externals/revm/crates/interpreter", features = [
"no_gas_measuring",
"serde",
] }
hex = "0.4"
primitive-types = { version = "0.12.1", features = ["rlp", "serde"] }
libafl = "0.8.2"
Expand All @@ -50,7 +76,7 @@ nix = "0.24"
serde = "1.0.147"
serde_traitobject = "0.2.7"
serde_json = "1.0.73"
z3 = {version="0.11.2", features = ["static-link-z3"]}
z3 = { version = "0.11.2", features = ["static-link-z3"] }
z3-sys = "0.7.1"
glob = "0.3.0"
rust-crypto = "0.2"
Expand All @@ -66,14 +92,17 @@ heimdall = { path = "./externals/heimdall-rs/heimdall" }

# from https://github.com/aptos-labs/aptos-core/blob/main/Cargo.toml#L452
move-binary-format = { path = "./externals/sui/external-crates/move/move-binary-format", optional = true }
move-core-types = { path = "./externals/sui/external-crates/move/move-core/types", features = ["address32"], optional = true }
move-core-types = { path = "./externals/sui/external-crates/move/move-core/types", features = [
"address32",
], optional = true }
move-stdlib = { path = "./externals/sui/external-crates/move/move-stdlib", optional = true }
move-vm-runtime = { path = "./externals/sui/external-crates/move/move-vm/runtime", features = ["lazy_natives"], optional = true }
move-vm-runtime = { path = "./externals/sui/external-crates/move/move-vm/runtime", features = [
"lazy_natives",
], optional = true }
move-vm-types = { path = "./externals/sui/external-crates/move/move-vm/types", optional = true }
sui-move-natives-latest = { path = "./externals/sui/sui-execution/latest/sui-move-natives", optional = true }
sui-protocol-config = { path = "./externals/sui/crates/sui-protocol-config", optional = true }
sui-types = { path = "./externals/sui/crates/sui-types", optional = true }

sui-protocol-config = { path = "./externals/sui/crates/sui-protocol-config", optional = true }
sui-types = { path = "./externals/sui/crates/sui-types", optional = true }


retry = "2.0.0"
Expand Down
9 changes: 6 additions & 3 deletions src/evm/onchain/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,12 +919,17 @@ impl OnChainConfig {
}

fn fetch_reserve(&self, pair: &str, block: &str) -> (String, String) {
let block = if block.parse::<u64>().is_ok() {
format!("0x{:x}", block.parse::<u64>().unwrap())
} else {
block.to_string()
};
let result = {
let params = json!([{
"to": pair,
"data": "0x0902f1ac",
"id": 1
}, block.parse::<u64>().unwrap_or_default()]);
}, block]);
println!("fetching reserve for {pair} {block} {params}");
let resp = self._request_with_id("eth_call".to_string(), params.to_string(), 1);
match resp {
Expand All @@ -933,8 +938,6 @@ impl OnChainConfig {
}
};

println!("fetching reserve for {pair} {block} {result}");

let reserve1 = &result[3..67];
let reserve2 = &result[67..131];

Expand Down

0 comments on commit 35f807c

Please sign in to comment.