Skip to content

Commit

Permalink
[easy] Fix GasBudgetTooHigh and GasBudgetTooLow error (MystenLabs#10159)
Browse files Browse the repository at this point in the history
## Description 

Community is reporting seeing confusing error message like

```
message": "Error checking transaction input objects: GasBudgetTooLow { gas_budget: 30000, min_budget: 110 }"
```

where their provided gas_budget is greater than the min_budget. This is
because `min_budget` does not take rgp into consideration

## Test Plan 

CI build

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
666lcz authored Mar 30, 2023
1 parent f5dffd6 commit cf6bc1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/sui-types/src/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,13 @@ pub fn check_gas_balance(
if required_gas_amount > max_gas_budget {
return Err(UserInputError::GasBudgetTooHigh {
gas_budget,
max_budget: cost_table.max_gas_budget,
max_budget: max_gas_budget as u64,
});
}
if required_gas_amount < min_gas_budget {
return Err(UserInputError::GasBudgetTooLow {
gas_budget,
min_budget: cost_table.min_gas_budget_external(),
min_budget: min_gas_budget as u64,
});
}

Expand Down

0 comments on commit cf6bc1f

Please sign in to comment.