From 1dc9a481eb6f23dd9f8219ea021111c4825d7610 Mon Sep 17 00:00:00 2001 From: MozirDmitriy Date: Tue, 2 Sep 2025 12:48:21 +0300 Subject: [PATCH 1/4] Add guards for zero gameCount to prevent U256 underflow --- lib/base-client/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base-client/src/lib.rs b/lib/base-client/src/lib.rs index cff0dede64..11bf067ed1 100644 --- a/lib/base-client/src/lib.rs +++ b/lib/base-client/src/lib.rs @@ -21,7 +21,7 @@ pub async fn finalized_l2_block_number_of_l1_block_number( l1_provider, l1_block_number, l1_dispute_game_factory_proxy, - count - U256::ONE, + count.saturating_sub(U256::ONE), ) .await } From 3168118c128536af957c44589987546bf49b8406 Mon Sep 17 00:00:00 2001 From: MozirDmitriy Date: Tue, 2 Sep 2025 12:48:48 +0300 Subject: [PATCH 2/4] Add guards for zero gameCount to prevent U256 underflow --- lib/bob-client/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bob-client/src/lib.rs b/lib/bob-client/src/lib.rs index cff0dede64..11bf067ed1 100644 --- a/lib/bob-client/src/lib.rs +++ b/lib/bob-client/src/lib.rs @@ -21,7 +21,7 @@ pub async fn finalized_l2_block_number_of_l1_block_number( l1_provider, l1_block_number, l1_dispute_game_factory_proxy, - count - U256::ONE, + count.saturating_sub(U256::ONE), ) .await } From 35f5d350e0e2fe6b015b8f9f8ed7d3ece8f3613f Mon Sep 17 00:00:00 2001 From: MozirDmitriy Date: Tue, 2 Sep 2025 12:49:32 +0300 Subject: [PATCH 3/4] Add guards for zero gameCount to prevent U256 underflow --- voyager/plugins/client-update/base/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/voyager/plugins/client-update/base/src/main.rs b/voyager/plugins/client-update/base/src/main.rs index 8db46103b6..6a0543481d 100644 --- a/voyager/plugins/client-update/base/src/main.rs +++ b/voyager/plugins/client-update/base/src/main.rs @@ -618,6 +618,14 @@ impl Module { .await .map_err(|err| ErrorObject::owned(-1, ErrorReporter(err).to_string(), None::<()>))?; + if game_index.is_zero() { + return Err(ErrorObject::owned( + -1, + "no dispute games at this L1 block height".to_string(), + None::<()>, + )); + } + let game_index = game_index - U256::ONE; let dispute_game_factory_account_proof = self From 6a12240ab94bf91f03eb2125a09204f88cd2cf10 Mon Sep 17 00:00:00 2001 From: MozirDmitriy Date: Tue, 2 Sep 2025 12:49:59 +0300 Subject: [PATCH 4/4] Add guards for zero gameCount to prevent U256 underflow --- voyager/plugins/client-update/bob/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/voyager/plugins/client-update/bob/src/main.rs b/voyager/plugins/client-update/bob/src/main.rs index d8f9cf4624..aeee201ba4 100644 --- a/voyager/plugins/client-update/bob/src/main.rs +++ b/voyager/plugins/client-update/bob/src/main.rs @@ -630,6 +630,14 @@ impl Module { .await .map_err(|err| ErrorObject::owned(-1, ErrorReporter(err).to_string(), None::<()>))?; + if game_index.is_zero() { + return Err(ErrorObject::owned( + -1, + "no dispute games at this L1 block height".to_string(), + None::<()>, + )); + } + let game_index = game_index - U256::ONE; let dispute_game_factory_account_proof = self