File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
crates/dry_hint_processor/src Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ use cairo_vm::{
88 } ,
99 hint_processor_utils:: felt_to_usize,
1010 } ,
11- types:: exec_scope:: ExecutionScopes ,
11+ types:: {
12+ exec_scope:: ExecutionScopes ,
13+ relocatable:: MaybeRelocatable ,
14+ } ,
1215 vm:: { errors:: hint_errors:: HintError , vm_core:: VirtualMachine } ,
1316 Felt252 ,
1417} ;
@@ -55,9 +58,15 @@ impl CustomHintProcessor {
5558 . get_continuous_range ( retdata_ptr, len) ?
5659 . into_iter ( )
5760 . map ( |value| {
58- value
59- . get_int ( )
60- . ok_or_else ( || HintError :: CustomHint ( "retdata contains relocatable value, expected felt" . to_string ( ) . into_boxed_str ( ) ) )
61+ match value {
62+ MaybeRelocatable :: Int ( felt) => Ok ( felt) ,
63+ MaybeRelocatable :: RelocatableValue ( relocatable) => {
64+ let segment_index = Felt252 :: from ( relocatable. segment_index ) ;
65+ let offset = Felt252 :: from ( relocatable. offset ) ;
66+ let two_to_64 = Felt252 :: from ( 2u64 ) . pow ( 64u128 ) ;
67+ Ok ( segment_index * two_to_64 + offset)
68+ }
69+ }
6170 } )
6271 . collect :: < Result < Vec < Felt252 > , HintError > > ( ) ?;
6372
You can’t perform that action at this time.
0 commit comments