Skip to content

Commit

Permalink
Merge pull request #19 from lambdaclass/fix_u64
Browse files Browse the repository at this point in the history
update resource bounds
  • Loading branch information
edg-l authored Nov 12, 2024
2 parents 783b577 + 889d5f4 commit 6f14879
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/starknet/resource_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ use starknet_types_core::felt::Felt;
pub struct ResourceBounds {
pub resource: Felt,
pub max_amount: u64,
pub max_price_per_unit: u128,
pub max_price_per_unit: u64,
}

impl ResourceBounds {
pub(crate) fn into_value(self) -> Value {
Value::Struct(vec![
Value::Felt(self.resource),
Value::U64(self.max_amount),
Value::U128(self.max_price_per_unit),
Value::U64(self.max_price_per_unit),
])
}
}
6 changes: 4 additions & 2 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ impl Value {
CoreTypeConcrete::Sint64(_) => todo!(),
CoreTypeConcrete::Nullable(info) => self.is(registry, &info.ty),
CoreTypeConcrete::Uninitialized(_) => matches!(self, Self::Uninitialized { .. }),
CoreTypeConcrete::Felt252DictEntry(info) => matches!(self, Self::FeltDictEntry { ty, .. } if *ty == info.ty),
CoreTypeConcrete::Felt252DictEntry(info) => {
matches!(self, Self::FeltDictEntry { ty, .. } if *ty == info.ty)
}
CoreTypeConcrete::SquashedFelt252Dict(info) => {
matches!(self, Self::FeltDict { ty, .. } if *ty == info.ty)
},
}
CoreTypeConcrete::Pedersen(_) => matches!(self, Self::Unit),
CoreTypeConcrete::Poseidon(_) => matches!(self, Self::Unit),
CoreTypeConcrete::Span(_) => todo!(),
Expand Down
5 changes: 2 additions & 3 deletions src/vm/uint128.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::EvalAction;
use crate::{debug::debug_signature, Value};
use crate::Value;
use cairo_lang_sierra::{
extensions::{
core::{CoreLibfunc, CoreType},
Expand Down Expand Up @@ -248,8 +248,7 @@ mod test {

let result = run_test_program(program);

let Value::U64(payload) = result.last().unwrap()
else {
let Value::U64(payload) = result.last().unwrap() else {
panic!("No output");
};

Expand Down

0 comments on commit 6f14879

Please sign in to comment.