Skip to content

Commit

Permalink
fix: Check gas limit before padding (#1734)
Browse files Browse the repository at this point in the history
  • Loading branch information
m30m authored Jun 26, 2024
1 parent 05dc9c8 commit 35ee573
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/fortuna/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/fortuna/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fortuna"
version = "6.4.0"
version = "6.4.1"
edition = "2021"

[dependencies]
Expand Down
5 changes: 3 additions & 2 deletions apps/fortuna/src/keeper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,6 @@ pub async fn process_event(
backoff::Error::transient(anyhow!("Error estimating gas for reveal: {:?}", e))
})?;

// Pad the gas estimate by 33%
let gas_estimate = gas_estimate.saturating_mul(4.into()) / 3;

if gas_estimate > gas_limit {
return Err(backoff::Error::permanent(anyhow!(
Expand All @@ -463,6 +461,9 @@ pub async fn process_event(
)));
}

// Pad the gas estimate by 25% after checking it against the gas limit
let gas_estimate = gas_estimate.saturating_mul(5.into()) / 4;

let contract_call = contract
.reveal_with_callback(
event.provider_address,
Expand Down

0 comments on commit 35ee573

Please sign in to comment.