Skip to content

Commit

Permalink
rusk: Add test cases for large feeder_call_gas deser
Browse files Browse the repository at this point in the history
  • Loading branch information
HDauven committed Oct 29, 2024
1 parent 4ee4eaa commit 0b5ccfb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rusk/default.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#key = <path_of_key>

# The default max cost for feeder calls is the maximum representable. Put in a
# a string wrapped number up to u64
# a string wrapped number up to u64::MAX
#feeder_call_gas = "18446744073709551615"

#ws_sub_channel_cap = 16,
Expand Down
14 changes: 14 additions & 0 deletions rusk/src/bin/config/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,18 @@ mod tests {
let result = toml::from_str::<HttpConfig>(config_str);
assert!(result.is_err());
}

#[test]
fn deserialize_large_feeder_call_gas() {
// A feeder_call_gas value beyond i64::MAX, but within u64 limits
let config_str = r#"feeder_call_gas = "9999999999999999999""#;
let config: HttpConfig = toml::from_str(config_str)
.expect("parsing large u64 value should succeed");
assert_eq!(config.feeder_call_gas, 9999999999999999999);

let config_str = r#"feeder_call_gas = "18446744073709551615""#; // u64::MAX
let config: HttpConfig = toml::from_str(config_str)
.expect("parsing u64::MAX should succeed");
assert_eq!(config.feeder_call_gas, u64::MAX);
}
}

0 comments on commit 0b5ccfb

Please sign in to comment.