-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
impl GASPRICE opcode (#97) #377
Conversation
Codecov ReportBase: 87.53% // Head: 87.55% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #377 +/- ##
==========================================
+ Coverage 87.53% 87.55% +0.02%
==========================================
Files 23 23
Lines 3545 3553 +8
==========================================
+ Hits 3103 3111 +8
Misses 442 442
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
let calldata_len = self.call_context.calldata_len; | ||
let count = Helpers.count_nonzeroes(nonzeroes=0, idx=0, arr_len=calldata_len, arr=calldata); | ||
let zeroes = calldata_len - count.nonzeroes; | ||
let calldata_cost = zeroes * 4 + count.nonzeroes * 16; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also factorize like
Cost = 4*len + 12*nonzeroes
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Resolves #97
What is the new behavior?
ExecutionContext.intrinsic_gas_cost
->ExecutionContext.gas_price
Helpers.count_nonzeroes
that returns the count of the nonzeroes of the calldata arrayConstants.TRANSACTION_INTRINSIC_GAS_COST
ExecutionContext.compute_intrinsic_gas_cost
ExecutionContext.increment_gas_used
and use the context returned from thatOther information