-
Notifications
You must be signed in to change notification settings - Fork 329
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
Deprecate gas_adjustment
in favor of new gas_multiplier
setting
#2353
Conversation
13592de
to
d39d677
Compare
d39d677
to
e4cb25c
Compare
9b67d25
to
54d2899
Compare
relayer/src/chain/cosmos/gas.rs
Outdated
let gas = if digits.len() == 1 { | ||
// If the result fits in a u64, use that | ||
digits[0] | ||
} else { | ||
// Otherwise, use u64::MAX | ||
u64::MAX | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The case where the gas_amount
is simulated to 0 will cause to have the computed gas being u64::MAX, and thus the value returned by adjust_estimated_gas
to be the max_gas
configured.
Is this expected ? In the case this is expected, should there be a trace warning or error to inform that the simulated gas for the tx was 0 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…nformalsystems#2353) # Description This PR does the following: (cf. informalsystems#2174 (comment)) 1. Let's deprecate `gas_adjustment`. The name of the setting does not properly convey what is used for imho, and its semantics (multiply the estimated gas by the value and add it to the estimation) are confusing. 2. Instead, replace it with a `gas_multiplier` setting, with the following semantics: take the estimated gas and multiply it by the value of the setting. Meaning that when we previously had `gas_adjustment = 0.1`, which increases the gas by 10%, we would now have `gas_multiplier = 1.1`. This PR enforces a lower bound of `1.0` for the new setting but no upper bound so that people are free to use as high gas as they want. # Commits * Deprecate `gas_adjustment` in favor of new `gas_multiplier` setting * Add changelog entry * Add tests for `adjust_gas` * Fix `unused_variable` warning * Improve tests * Fix typo in test code * Use 1.1 gas_multiplier in mock tests * Return zero when `gas_amount` is zero, instead of max_gas * Short-circuit when gas_amount = 0 or gas_multiplier = 1
Closes: #2174
Description
This PR does the following: (cf. #2174 (comment))
gas_adjustment
. The name of the setting does not properly convey what is used for imho, and its semantics (multiply the estimated gas by the value and add it to the estimation) are confusing.gas_multiplier
setting, with the following semantics: take the estimated gas and multiply it by the value of the setting.Meaning that when we previously had
gas_adjustment = 0.1
, which increases the gas by 10%, we would now havegas_multiplier = 1.1
.This PR enforces a lower bound of
1.0
for the new setting but no upper bound so that people are free to use as high gas as they want.Note regarding backward incompatibility
This PR aims to hand-hold operators to use the new setting instead of the old one whenever they update to the Hermes version including these changes (1.0.0).
If an operator is still using the
gas_adjustment
setting in their config, they will be greeted with the following message when they try to run any command, as well asconfig validate
:Note: the message above arises when
gas_adjustment
is set to0.1
in the config of chainibc-0
.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.