Skip to content

Commit

Permalink
piecrust: fix overflow in ICC gas limit calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Leegwater Simões committed Feb 7, 2024
1 parent ac38650 commit 3228361
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions piecrust/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Upgrade `dusk-wasmtime` to version `17`

### Fixed

- Fix overflow in gas limit calculation in inter-contract call

## [0.15.0] - 2024-01-24

### Changed
Expand Down
4 changes: 3 additions & 1 deletion piecrust/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ pub(crate) fn c(
let callee_limit = if gas_limit > 0 && gas_limit < caller_remaining {
gas_limit
} else {
caller_remaining * GAS_PASS_PCT / 100
let div = caller_remaining / 100 * GAS_PASS_PCT;
let rem = caller_remaining % 100 * GAS_PASS_PCT / 100;
div + rem
};

let with_memory = |memory: &mut [u8]| -> Result<_, Error> {
Expand Down

0 comments on commit 3228361

Please sign in to comment.