File tree Expand file tree Collapse file tree 1 file changed +24
-14
lines changed 
vm/src/hint_processor/builtin_hint_processor/secp Expand file tree Collapse file tree 1 file changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -121,14 +121,14 @@ mod tests {
121121                . to_biguint ( ) 
122122                . expect ( "Couldn't convert to BigUint" ) , 
123123        ) ; 
124-          //TODO, Check SecpSplitutOfRange limit 
125-         let  array_4  = bigint3_split ( 
126-              & bigint_str ! ( 
127-                  "773712524553362671811952647737125245533626718119526477371252455336267181195264" 
128-              ) 
129-              . to_biguint ( ) 
130-              . expect ( "Couldn't convert to BigUint" ) , 
131-         ) ; 
124+ 
125+         let  max_value  = & * BASE   *   & * BASE   *   & * BASE  -  BigUint :: from ( 1u32 ) ; 
126+         let  over_max_value =  & * BASE   *   & * BASE   *   & * BASE ; 
127+         let  way_over_max_value =  & * BASE   *   & * BASE   *   & * BASE   *   & * BASE ; 
128+ 
129+         let  array_max =  bigint3_split ( & max_value ) ; 
130+         let  array_over_max =  bigint3_split ( & over_max_value ) ; 
131+         let  array_way_over_max =  bigint3_split ( & way_over_max_value ) ; 
132132
133133        assert_matches ! ( 
134134            array_1, 
@@ -158,14 +158,24 @@ mod tests {
158158                    . expect( "Couldn't convert to BigUint" ) 
159159            ] 
160160        ) ; 
161+ 
161162        assert_matches ! ( 
162-             array_4, 
163-             Err ( HintError :: SecpSplitOutOfRange ( bx) )  if  * bx == bigint_str!( 
164-                     "773712524553362671811952647737125245533626718119526477371252455336267181195264" 
165-                 ) 
166-                     . to_biguint( ) 
167-                     . expect( "Couldn't convert to BigUint" ) 
163+             array_max, 
164+             Ok ( x)  if  x == [ 
165+                 BASE_MINUS_ONE . clone( ) , 
166+                 BASE_MINUS_ONE . clone( ) , 
167+                 BASE_MINUS_ONE . clone( ) 
168+             ] 
169+         ) ; 
170+ 
171+         assert_matches ! ( 
172+             array_over_max, 
173+             Err ( HintError :: SecpSplitOutOfRange ( bx) )  if  * bx == over_max_value
174+         ) ; 
168175
176+         assert_matches ! ( 
177+             array_way_over_max, 
178+             Err ( HintError :: SecpSplitOutOfRange ( bx) )  if  * bx == way_over_max_value
169179        ) ; 
170180    } 
171181} 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments