You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Opcodes CALL, CALLCODE, DELEGATECALL and STATICCALL had a lot of the gas consumption process in common and they presented repeated code.
Now a new function calculate_call_gas_costs() that returns the sum of all different costs exists. It calculates memory expansion and address access costs (that is done the same way for the four opcodes). Also includes in the sum the values of positive_value_cost and value_to_empty_account (that are optional and each opcode handles differently). The opcodes that do not have this value pass None which translates to adding 0.
The reason will be displayed to describe this comment to others. Learn more.
Why are there no changes to system.rs? The goal was to simplify that part. Look at those opcodes and find the // GAS comment, that behavior is repeated in different calls.
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.
This PR addresses issue #3095.
Opcodes
CALL
,CALLCODE
,DELEGATECALL
andSTATICCALL
had a lot of the gas consumption process in common and they presented repeated code.Now a new function
calculate_call_gas_costs()
that returns the sum of all different costs exists. It calculates memory expansion and address access costs (that is done the same way for the four opcodes). Also includes in the sum the values ofpositive_value_cost
andvalue_to_empty_account
(that are optional and each opcode handles differently). The opcodes that do not have this value passNone
which translates to adding0
.