Repository navigation
Conversation
When both `consume_fuel` and `epoch_interruption` are enabled, `FuncEnvironment::epoch_check_full` emits a conditional call to the `new_epoch` libcall at function entry and loop headers. Although `fuel_check` flushes buffered fuel into the SSA variable `self.fuel_var` immediately beforehand, `epoch_check_full` did not store `self.fuel_var` back to `VMStoreContext::fuel_consumed` before invoking `new_epoch` or reload it afterwards. Consequently, if the epoch deadline callback inspected `store.get_fuel()` or trapped (`UpdateDeadline::Interrupt` / `Err(...)`), all fuel consumed since the last store synchronization was missing from the `Store`. Save `self.fuel_var` before calling `new_epoch` and reload `self.fuel_var` afterwards when `consume_fuel` is enabled. Assisted-by: Gemini
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When both
consume_fuelandepoch_interruptionare enabled,FuncEnvironment::epoch_check_fullemits a conditional call to thenew_epochlibcall at function entry and loop headers. Althoughfuel_checkflushes buffered fuel into the SSA variableself.fuel_varimmediately beforehand,epoch_check_fulldid not storeself.fuel_varback toVMStoreContext::fuel_consumedbefore invokingnew_epochor reload it afterwards.Consequently, if the epoch deadline callback inspected
store.get_fuel()or trapped (UpdateDeadline::Interrupt/Err(...)), all fuel consumed since the last store synchronization was missing from theStore.Save
self.fuel_varbefore callingnew_epochand reloadself.fuel_varafterwards whenconsume_fuelis enabled.Assisted-by: Gemini