File tree Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 11[workspace ]
22members = [
33 " programs/*" ,
4- " modules/*"
4+ " modules/*" ,
55]
66resolver = " 2"
77
Original file line number Diff line number Diff line change 11[package ]
22name = " ntt-fuzz"
33version = " 0.0.1"
4+ edition = " 2021"
45
56[[bin ]]
6- name = " ntt- fuzz"
7+ name = " fuzz-trimmed-amount "
78path = " fuzz_trimmed_amount.rs"
9+ [[bin ]]
10+ name = " fuzz-rate-limit-state"
11+ path = " fuzz_rate_limit.rs"
812
9- edition = " 2021"
1013[dependencies ]
1114ntt-messages = { path = " ../../modules/ntt-messages" }
15+ example-native-token-transfers = { path = " ../../programs/example-native-token-transfers" }
1216honggfuzz = " 0.5"
1317arbitrary = { version = " 1" , optional = true , features = [" derive" ] }
1418
Original file line number Diff line number Diff line change 1+ use honggfuzz:: fuzz;
2+ use example_native_token_transfers:: queue:: rate_limit:: RateLimitState ;
3+
4+ fn main ( ) {
5+ loop {
6+ fuzz ! ( |input: ( u64 , u64 ) | {
7+ let ( limit, new_limit) = input;
8+
9+ let mut rls = RateLimitState :: new( limit) ;
10+ rls. set_limit( new_limit)
11+ } ) ;
12+ }
13+ }
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ impl TrimmedAmount {
6161 return Ok ( amount) ;
6262 }
6363 if from_decimals > to_decimals {
64+ // [`u64::checked_pow`] expects a u32 argument
6465 let power: u32 = ( from_decimals - to_decimals) . into ( ) ;
6566 // Exponentiation will overflow u64 when `power` is greater than 18
6667 let scaling_factor: u64 = 10u64
@@ -69,6 +70,7 @@ impl TrimmedAmount {
6970
7071 Ok ( amount / scaling_factor)
7172 } else {
73+ // [`u64::checked_pow`] expects a u32 argument
7274 let power: u32 = ( to_decimals - from_decimals) . into ( ) ;
7375
7476 // Exponentiation will overflow u64 when `power` is greater than 18
You can’t perform that action at this time.
0 commit comments