Skip to content

Commit

Permalink
feat: add env to enable/disable game resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
fakedev9999 committed Jan 30, 2025
1 parent fee6158 commit 30312f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions proposer/fp/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub struct Config {
pub proposal_interval_in_blocks: u64,
pub fetch_interval: u64,
pub game_type: u32,
pub enable_game_resolution: bool,
pub max_games_to_check_for_resolution: u64,
}

Expand All @@ -31,6 +32,9 @@ impl Config {
.unwrap_or("30".to_string())
.parse()?,
game_type: env::var("GAME_TYPE").unwrap_or("42".to_string()).parse()?,
enable_game_resolution: env::var("ENABLE_GAME_RESOLUTION")
.unwrap_or("false".to_string())
.parse()?,
max_games_to_check_for_resolution: env::var("MAX_GAMES_TO_CHECK_FOR_RESOLUTION")
.unwrap_or("100".to_string())
.parse()?,
Expand Down
9 changes: 5 additions & 4 deletions proposer/fp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,11 @@ impl OPSuccicntProposer {
.await?;
}

// Try to resolve any unchallenged games
// TODO(fakedev9999): Add a flag to disable this
if let Err(e) = self.resolve_unchallenged_games().await {
tracing::warn!("Failed to resolve unchallenged games: {:?}", e);
// Only attempt game resolution if enabled
if self.config.enable_game_resolution {
if let Err(e) = self.resolve_unchallenged_games().await {
tracing::warn!("Failed to resolve unchallenged games: {:?}", e);
}
}
}
}
Expand Down

0 comments on commit 30312f0

Please sign in to comment.