Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Check gas limit before padding #1734

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading