Skip to content

Commit

Permalink
remove prints
Browse files Browse the repository at this point in the history
  • Loading branch information
brockelmore committed Jul 22, 2024
1 parent 35e0232 commit 2c8e918
Show file tree
Hide file tree
Showing 18 changed files with 10 additions and 217 deletions.
13 changes: 0 additions & 13 deletions crates/analyzers/src/func_analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ impl<'a> FunctionVarsBoundAnalysis {
.iter()
.map(|var| (var.as_controllable_name(analyzer, arena).unwrap(), var))
.collect::<BTreeMap<_, _>>();
// create the bound strings
// let atoms = ctx.dep_atoms(analyzer).unwrap();
// println!("had {} atoms", atoms.len());
// let mut handled_atom = vec![];
// let mut bounds_string: Vec<String> = vec![];
// atoms.iter().enumerate().for_each(|(i, atom)| {
// let atom_str = atom.to_range_string(true, analyzer, arena).s;
// if !handled_atom.contains(&atom_str) {
// handled_atom.push(atom_str.clone());
// bounds_string.push(format!("{}. {}", i + 1, atom_str))
// }
// });
// let bounds_string = bounds_string.into_iter().collect::<Vec<_>>().join("\n");

let bounds_string = deps
.iter()
Expand Down
12 changes: 0 additions & 12 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ fn main() {

println!("DONE ANALYZING IN: {parse_time}ms. Writing to cli...");

// println!("Arena: {:#?}", analyzer.range_arena);
if unsafe { USE_DEBUG_SITE } {
use pyrometer::graph_backend::mermaid_str;
use pyrometer::graph_backend::post_to_site_arena;
Expand All @@ -328,7 +327,6 @@ fn main() {
if args.stats {
println!("{}", analyzer.stats(t_end, arena));
}
// println!("Arena: {:#?}", analyzer.range_arena);

// use self.sources to fill a BTreeMap with the file_no and SourcePath.path_to_solidity_file
let mut file_mapping: BTreeMap<usize, String> = BTreeMap::new();
Expand Down Expand Up @@ -370,20 +368,10 @@ fn main() {
analyzer.open_mermaid(arena);
}

// println!("{}", analyzer.range_arena.ranges.iter().map(|i| {
// let j = i.borrow();
// let (min_cached, max_cached) = j.is_min_max_cached(&analyzer);
// format!("\t{j}, is cached: {min_cached}, {max_cached}\n")
// }).collect::<Vec<_>>().join(""));
// println!("{}", analyzer.range_arena.map.iter().map(|(k, v)| {
// format!("\t{}: {}\n", k, v)
// }).collect::<Vec<_>>().join(""));

if args.debug {
return;
}

// println!("getting contracts");
let all_contracts = analyzer
.search_children(entry, &Edge::Contract)
.into_iter()
Expand Down
6 changes: 1 addition & 5 deletions crates/graph/src/nodes/context/solving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@ impl ContextNode {
analyzer: &mut impl GraphBackend,
arena: &mut RangeArena<Elem<Concrete>>,
) -> Result<bool, GraphError> {
// println!("checking unreachable: {}", self.path(analyzer));
let mut solver = self.dl_solver(analyzer)?.clone();
match solver.solve_partial(analyzer, arena)? {
SolveStatus::Unsat => {
tracing::trace!("{} is unreachable via UNSAT", self.path(analyzer));
Ok(true)
}
_e => {
// println!("other: {e:?}");
Ok(false)
}
_e => Ok(false),
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/graph/src/nodes/context/variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ impl ContextNode {
}

pub fn contract_vars_referenced_global(&self, analyzer: &impl AnalyzerBackend) -> Vec<VarNode> {
println!("getting storage vars for: {}", self.path(analyzer));
let mut reffed_storage = self.contract_vars_referenced(analyzer);
analyzer
.graph()
Expand Down
4 changes: 0 additions & 4 deletions crates/graph/src/nodes/debug_reconstruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,6 @@ impl FunctionNode {
&self,
analyzer: &mut impl AnalyzerBackend,
) -> FuncReconstructionReqs {
println!(
"reconstruction requirements for: {}",
self.name(analyzer).unwrap()
);
FuncReconstructionReqs {
storage: self.maybe_used_storage(analyzer).unwrap_or_default(),
usertypes: self.maybe_used_usertypes(analyzer).unwrap_or_default(),
Expand Down
5 changes: 0 additions & 5 deletions crates/graph/src/range/elem/elem_enum/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ impl RangeArenaLike<Elem<Concrete>> for RangeArena<Elem<Concrete>> {
self.map.insert(Elem::Null, 0);
}

// println!(
// "{}\nhad cycle:\n{:?}",
// self.debug_str(analyzer),
// petgraph::dot::Dot::new(&self.to_graph(analyzer).unwrap()) // petgraph::algo::toposort(&self.to_graph(analyzer).unwrap(), None).is_err()
// );
match elem {
Elem::Arena(idx) => return idx,
Elem::Null => return 0,
Expand Down
3 changes: 0 additions & 3 deletions crates/graph/src/range/elem/expr/collapse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ pub fn collapse(
tracing::trace!("collapsing: {l} {op} {r}");

let l = if let Elem::Expr(e) = l {
//println!("collapsing lhs");
match collapse(*e.lhs, e.op, *e.rhs, arena) {
MaybeCollapsed::Not(l, op, r) => Elem::Expr(RangeExpr::new(l, op, r)),
MaybeCollapsed::Concretes(l, op, r) => Elem::Expr(RangeExpr::new(l, op, r)),
Expand All @@ -71,7 +70,6 @@ pub fn collapse(
};

let r = if let Elem::Expr(e) = r {
//println!("collapsing rhs");
match collapse(*e.lhs, e.op, *e.rhs, arena) {
MaybeCollapsed::Not(l, op, r) => Elem::Expr(RangeExpr::new(l, op, r)),
MaybeCollapsed::Concretes(l, op, r) => Elem::Expr(RangeExpr::new(l, op, r)),
Expand Down Expand Up @@ -193,7 +191,6 @@ pub fn collapse(
if (ords.x_eq_z() || ords.y_eq_z())
|| z.range_eq(&Elem::from(Concrete::from(true)), arena)
{
println!("collapsed == true");
MaybeCollapsed::Collapsed(Elem::Expr(expr))
} else {
MaybeCollapsed::Not(Elem::Expr(expr), op, z)
Expand Down
1 change: 0 additions & 1 deletion crates/graph/src/range/elem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ impl RangeOp {
Gt => Lt,
Lt => Gt,
other => {
println!("other:{other:?}");
return None;
}
};
Expand Down
15 changes: 4 additions & 11 deletions crates/graph/src/solvers/atoms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ impl Atomize for Elem<Concrete> {
expr.rhs.atoms_or_part(Some(self), analyzer, arena),
) {
(ref lp @ AtomOrPart::Part(ref l), ref rp @ AtomOrPart::Part(ref r)) => {
// println!("part part");
match (l, r) {
(_, Elem::Arena(_)) => todo!(),
(Elem::Arena(_), _) => todo!(),
Expand Down Expand Up @@ -385,16 +384,12 @@ impl Atomize for Elem<Concrete> {
}
}
(AtomOrPart::Atom(l_atom), r @ AtomOrPart::Part(_)) => {
// println!("atom part");

AtomOrPart::Atom(l_atom.add_rhs(expr.op, r))
}
(l @ AtomOrPart::Part(_), AtomOrPart::Atom(r_atom)) => {
// println!("part atom");
AtomOrPart::Atom(r_atom.add_lhs(expr.op, l))
}
(AtomOrPart::Atom(l_atoms), AtomOrPart::Atom(r_atoms)) => {
// println!("atom atom");
AtomOrPart::Atom(r_atoms.add_lhs(expr.op, AtomOrPart::Atom(l_atoms)))
}
}
Expand All @@ -412,14 +407,12 @@ impl Atomize for Elem<Concrete> {
use Elem::*;
tracing::trace!("atomize: {}", self);
match self {
Reference(_) => None, //{ println!("was dyn"); None},
Null => None, //{ println!("was null"); None},
Concrete(_c) => None, //{ println!("was conc: {}", _c.val.as_human_string()); None },
ConcreteDyn(_) => None, //{ println!("was concDyn"); None},
Reference(_) => None,
Null => None,
Concrete(_c) => None,
ConcreteDyn(_) => None,
Expr(_) => {
// println!("atomized: was expr");
let AtomOrPart::Atom(mut a) = self.atoms_or_part(None, analyzer, arena) else {
// println!("returning none");
return None;
};
a.update_max_ty();
Expand Down
Loading

0 comments on commit 2c8e918

Please sign in to comment.