Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update resource bounds #19

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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