Skip to content

Commit

Permalink
Remove missing todos (#1055)
Browse files Browse the repository at this point in the history
* Remove missing todos

* Update src/compiler.rs

Co-authored-by: MrAzteca <[email protected]>

* Update src/types/circuit.rs

Co-authored-by: MrAzteca <[email protected]>

* Update src/libfuncs/int.rs

Co-authored-by: MrAzteca <[email protected]>

* fmt

* clippy

* fix

---------

Co-authored-by: MrAzteca <[email protected]>
  • Loading branch information
edg-l and azteca1998 authored Jan 23, 2025
1 parent ecb0c82 commit 5c3ea3d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
5 changes: 4 additions & 1 deletion src/bin/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ fn jitvalue_to_felt(value: &Value) -> Vec<Felt> {
felts
}
} else {
todo!()
// Assume its a regular enum.
let mut felts = vec![(*tag).into()];
felts.extend(jitvalue_to_felt(value));
felts
}
}
Value::Felt252Dict { value, .. } => {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ fn compile_func(
}
})
.collect::<Result<Vec<_>, _>>()?,
None => todo!(),
None => native_panic!("not yet implemented"),
};

block.append_operation(cf::cond_br(
Expand Down
4 changes: 2 additions & 2 deletions src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,9 @@ fn parse_result(
| CoreTypeConcrete::StarkNet(_)
| CoreTypeConcrete::Uint128MulGuarantee(_)
| CoreTypeConcrete::Circuit(_)
| CoreTypeConcrete::RangeCheck96(_) => todo!(),
| CoreTypeConcrete::RangeCheck96(_) => native_panic!("not yet implemented as results"),
// 2.9.0
CoreTypeConcrete::IntRange(_) => todo!(),
CoreTypeConcrete::IntRange(_) => native_panic!("not yet implemented as results"),
}
}

Expand Down
31 changes: 15 additions & 16 deletions src/libfuncs/const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,23 +269,22 @@ pub fn build_const_type_value<'ctx, 'this>(

entry.const_int_from_type(context, location, value, inner_ty)
}
CoreTypeConcrete::StarkNet(starnet_type) => match starnet_type {
StarkNetTypeConcrete::ClassHash(_) | StarkNetTypeConcrete::ContractAddress(_) => {
let value = match &info.inner_data.as_slice() {
[GenericArg::Value(value)] => value.clone(),
_ => return Err(Error::ConstDataMismatch),
};
CoreTypeConcrete::StarkNet(
StarkNetTypeConcrete::ClassHash(_) | StarkNetTypeConcrete::ContractAddress(_),
) => {
let value = match &info.inner_data.as_slice() {
[GenericArg::Value(value)] => value.clone(),
_ => return Err(Error::ConstDataMismatch),
};

let (sign, value) = value.into_parts();
let value = match sign {
Sign::Minus => PRIME.clone() - value,
_ => value,
};
let (sign, value) = value.into_parts();
let value = match sign {
Sign::Minus => PRIME.clone() - value,
_ => value,
};

entry.const_int_from_type(context, location, value, inner_ty)
}
_ => native_panic!("const for type {} not implemented", info.inner_ty),
},
entry.const_int_from_type(context, location, value, inner_ty)
}
CoreTypeConcrete::Uint8(_)
| CoreTypeConcrete::Uint16(_)
| CoreTypeConcrete::Uint32(_)
Expand All @@ -302,7 +301,7 @@ pub fn build_const_type_value<'ctx, 'this>(
}
_ => Err(Error::ConstDataMismatch),
},
_ => todo!("const for type {}", info.inner_ty),
_ => native_panic!("const for type {} not implemented", info.inner_ty),
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/libfuncs/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::{BlockExt, LibfuncHelper};
use crate::{
error::Result,
metadata::MetadataStorage,
native_panic,
types::TypeBuilder,
utils::{ProgramRegistryExt, PRIME},
};
Expand Down Expand Up @@ -636,7 +637,7 @@ fn build_square_root<'ctx, 'this>(
CoreTypeConcrete::Uint32(_) => (32, 16),
CoreTypeConcrete::Uint64(_) => (64, 32),
CoreTypeConcrete::Uint128(_) => (128, 64),
_ => unreachable!(),
_ => native_panic!("invalid value type in int square root"),
};

let k1 = entry.const_int(context, location, 1, input_bits)?;
Expand Down
4 changes: 1 addition & 3 deletions src/types/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ pub fn layout(

Ok(layout)
}
CircuitTypeConcrete::CircuitPartialOutputs(_) => {
todo!("CircuitPartialOutputs is noop for now")
}
CircuitTypeConcrete::CircuitPartialOutputs(_) => Ok(Layout::new::<()>()),
}
}

0 comments on commit 5c3ea3d

Please sign in to comment.