Skip to content

Commit

Permalink
state_mutability: use CALLDATASIZE from calldata.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
cdump committed Sep 22, 2024
1 parent dabf15b commit 39b033d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/state_mutability/calldata.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::Label;
use crate::evm::{calldata::CallData, element::Element, U256, VAL_4};
use crate::evm::{calldata::CallData, element::Element, U256, VAL_4, VAL_131072};
use std::error;

#[derive(Clone)]
Expand Down Expand Up @@ -40,6 +40,6 @@ impl CallData<Label> for CallDataImpl {
}

fn len(&self) -> U256 {
VAL_4
VAL_131072
}
}
18 changes: 0 additions & 18 deletions src/state_mutability/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{
utils::execute_until_function_start,
Selector, StateMutability,
};
use alloy_primitives::uint;

mod calldata;
use calldata::CallDataImpl;
Expand Down Expand Up @@ -105,15 +104,6 @@ fn analyze_payable(
.label = Some(Label::IsZero);
}

StepResult{op: op::CALLDATASIZE, ..} =>
{
if let Ok(s) = vm.stack.peek_mut() {
s.data = uint!(131072_U256).to_be_bytes();
} else {
break; // error
}
}

StepResult{op: op::JUMPI, sa: Some(sa), ..} =>
{
last_jumpi_callvalue =
Expand Down Expand Up @@ -171,14 +161,6 @@ fn analyze_view_pure_internal(
}

match ret.op {
op::CALLDATASIZE => {
if let Ok(s) = vm.stack.peek_mut() {
s.data = uint!(131072_U256).to_be_bytes();
} else {
break; // error
}
}

op::JUMPI => {
let other_pc = usize::try_from(ret.fa.expect("always set in vm.rs"))
.expect("set to usize in vm.rs");
Expand Down

0 comments on commit 39b033d

Please sign in to comment.