Skip to content

Commit 35ee573

Browse files
authored
fix: Check gas limit before padding (#1734)
1 parent 05dc9c8 commit 35ee573

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

apps/fortuna/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/fortuna/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fortuna"
3-
version = "6.4.0"
3+
version = "6.4.1"
44
edition = "2021"
55

66
[dependencies]

apps/fortuna/src/keeper.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,6 @@ pub async fn process_event(
452452
backoff::Error::transient(anyhow!("Error estimating gas for reveal: {:?}", e))
453453
})?;
454454

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

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

464+
// Pad the gas estimate by 25% after checking it against the gas limit
465+
let gas_estimate = gas_estimate.saturating_mul(5.into()) / 4;
466+
466467
let contract_call = contract
467468
.reveal_with_callback(
468469
event.provider_address,

0 commit comments

Comments
 (0)