INNER CODE UNIT · Rust

peek_realcall_target

fuzzland/ityfuzz · src/evm/middlewares/cheatcode/mod.rs:529

fn peek_realcall_target(interp: &Interpreter) -> Result<Address, InstructionResult> {
    let addr_bytes = interp.stack().peek(1)?;
    let addr: Address = addr_bytes.to_be_bytes::<{ U256::BYTES }>()[12..].try_into().unwrap();
    Ok(addr)
}

// Peek input and value only when target is in the expected calls.
//
// CALL|CALLCODE: gas, addr, val, in_offset, in_len, out_offset, out_len
// DELEGATECALL|STATICCALL: gas, addr, in_offset, in_len, out_offset, out_len
fn peek_realcall_input_value(interp: &mut Interpreter, op: u8) -> Result<(Bytes, U256), InstructionResult> {
    let value = if op == opcode::CALL || op == opcode::CALLCODE {
        interp.stack().peek(2)?
    } else {
        U256::ZERO
    };

    let (in_offset, in_len) = {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…