Gas fixes#83
Merged
rakita merged 2 commits intobluealloy:mainfrom Mar 17, 2022
onbjerg:onbjerg/gas-fixes
Merged
Conversation
onbjerg
commented
Mar 17, 2022
| self.data.subroutine.load_account(coinbase, self.data.db); | ||
| self.data.subroutine.balance_add(coinbase, U256::zero()); | ||
| } | ||
| 0 |
Collaborator
Author
There was a problem hiding this comment.
Unsure if we still want to do the gas refund calculation stuff here? Does crate::USE_GAS toggle if we even record gas at all?
Member
There was a problem hiding this comment.
This is fine, USE_GAS in general is to disable gas calculation if evm is needed in some wasm env where pricing is done differently.
gakonst
reviewed
Mar 17, 2022
| } | ||
|
|
||
| pub fn gas(&mut self) -> &Gas { | ||
| pub fn gas(&self) -> &Gas { |
| self.data.subroutine.load_account(coinbase, self.data.db); | ||
| self.data.subroutine.balance_add(coinbase, U256::zero()); | ||
| } | ||
| 0 |
| caller: H160, | ||
| gas: &Gas, | ||
| ) -> Result<(Map<H160, Account>, Vec<Log>), Return> { | ||
| ) -> (Map<H160, Account>, Vec<Log>, u64) { |
Collaborator
There was a problem hiding this comment.
The function signature change should be OK given that this function is not exposed
| if crate::USE_GAS { | ||
| gas.reimburse_unspend(&exit_reason, ret_gas); | ||
| } | ||
| match self.finalize::<GSPEC>(caller, &gas) { |
Collaborator
There was a problem hiding this comment.
Ack - the error branch would never get hit before
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.
The gas returned by the EVM did not account for refunds, and
Interpreter::gastook&mut selfwithout needing toI also made
finalizenot return aResultsince there was no path where it would returnErr