Skip to content

Commit 327d323

Browse files
authored
Increase gas price for quote verifications (#3952)
# Description Currently ~0.9% of the quote verifications fail because we pick an insufficient gas price (see [here](https://aws-es.cow.fi/_dashboards/app/data-explorer/discover#?_a=(discover:(columns:!(log,log_level),isDirty:!f,sort:!()),metadata:(indexPattern:'86e4a5a0-4e4b-11ef-85c5-3946a99ed1a7',view:discover))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_q=(filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'86e4a5a0-4e4b-11ef-85c5-3946a99ed1a7',key:kubernetes.container_image,negate:!t,params:(query:nginx),type:phrase),query:(match_phrase:(kubernetes.container_image:nginx)))),query:(language:kuery,query:'%22failed%20to%20simulate%20quote%22%20and%20%22max%20fee%20per%20gas%20less%20than%20block%20base%20fee%22'))). Not providing a gas price does not work because some tokens have special logic depending on the block's gas price. However, since we only need some working non-zero gas amount we can simply multiply it by 2 to ensure the gas price is always sufficient. The exact gas price we use doesn't really matter since we are only interested in computing the used gas units. # Changes Double the gas price used for the quote verification simulation.
1 parent 810c975 commit 327d323

File tree

1 file changed

+5
-1
lines changed
  • crates/shared/src/price_estimation/trade_verifier

1 file changed

+5
-1
lines changed

crates/shared/src/price_estimation/trade_verifier/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,12 @@ impl TradeVerifier {
175175
.from(solver_address)
176176
.to(solver_address)
177177
.gas(Self::DEFAULT_GAS)
178+
// Use a high enough non-zero gas price to catch tokens with special logic
179+
// for gas_price == 0 but also avoid reverts due to too low gas price.
180+
// The exact price is not important since we are only interested in the used
181+
// gas units anyway.
178182
.gas_price(
179-
u128::try_from(block.gas_price)
183+
u128::try_from(block.gas_price.saturating_mul(2.into()))
180184
.map_err(|err| anyhow!(err))
181185
.context("converting gas price to u128")?
182186
);

0 commit comments

Comments
 (0)