From d659c5249d8e185e0c15b577f3c36797dae4121f Mon Sep 17 00:00:00 2001 From: maradini77 <140460067+maradini77@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:55:31 +0100 Subject: [PATCH 1/2] Update logs.rs --- crates/cast/src/cmd/logs.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/cast/src/cmd/logs.rs b/crates/cast/src/cmd/logs.rs index b0da80fd44788..67073283582de 100644 --- a/crates/cast/src/cmd/logs.rs +++ b/crates/cast/src/cmd/logs.rs @@ -131,7 +131,13 @@ fn build_filter( /// Creates a [Filter] from the given event signature and arguments. fn build_filter_event_sig(event: Event, args: Vec) -> Result { + let arg_count = args.len(); let args = args.iter().map(|arg| arg.as_str()).collect::>(); + eyre::ensure!( + arg_count <= event.inputs.len(), + "too many indexed arguments supplied: got {arg_count}, expected at most {}", + event.inputs.len() + ); // Match the args to indexed inputs. Enumerate so that the ordering can be restored // when merging the inputs with arguments and without arguments @@ -321,6 +327,23 @@ mod tests { assert_eq!(filter, expected) } + #[test] + fn test_build_filter_sig_with_extra_arguments_errors() { + let result = build_filter( + None, + None, + None, + Some(TRANSFER_SIG.to_string()), + vec![ + String::new(), + ADDRESS.to_string(), + ADDRESS.to_string(), + ADDRESS.to_string(), + ], + ); + assert!(result.is_err()); + } + #[test] fn test_build_filter_with_topics() { let expected = Filter { From 7289626cdf337fe95ec519ccc9e97c160e32ce35 Mon Sep 17 00:00:00 2001 From: maradini77 <140460067+maradini77@users.noreply.github.com> Date: Mon, 24 Nov 2025 16:04:56 +0100 Subject: [PATCH 2/2] Update logs.rs --- crates/cast/src/cmd/logs.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/cast/src/cmd/logs.rs b/crates/cast/src/cmd/logs.rs index 67073283582de..2508e86efb9e3 100644 --- a/crates/cast/src/cmd/logs.rs +++ b/crates/cast/src/cmd/logs.rs @@ -334,12 +334,7 @@ mod tests { None, None, Some(TRANSFER_SIG.to_string()), - vec![ - String::new(), - ADDRESS.to_string(), - ADDRESS.to_string(), - ADDRESS.to_string(), - ], + vec![String::new(), ADDRESS.to_string(), ADDRESS.to_string(), ADDRESS.to_string()], ); assert!(result.is_err()); }